Results 1 to 1 of 1

Thread: Api Update

  1. #1
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56

    Api Update

    Hi,


    New api.inc.


    New elements are:


    GetR(color)
    GetG(color)
    GetB(color)


    Music and Sound are now also possible.


    Examples:
    Uses "ui"
    #INCLUDE "api.inc"
    
    
    DWord hdc, hwnd
    hwnd = Canvas_Window("api_app",xMid(640),yMid(480),640,480)
    Canvas_Attach(hwnd,0,%TRUE) 
    hdc = Canvas_GetDC() 
    Canvas_Font "courier",16, %CANVAS_FONTSTYLE_BOLD   
    
    
    Dim ic1,ic2 As Long
    Dim c, k As DWord 
    Dim r,g,b As Byte
     
    ic1 = LoadIcon "icon/bild3.ico"
    ic2 = LoadIcon "icon/shoot.ico"
    
    
    While IsWindow(hwnd) And Keydown(%VK_ESCAPE)=0 
      DrawIcon hdc,ic1,0,0,640,480,0
      DrawIcon hdc,ic2,256,300,128,128,0
      
      c = Canvas_GetPixel 320,384
      r = GetR(c)
      g = GetG(c)
      b = GetB(c)    
      Canvas_Ellipse 200,200,80+200,60+200, Rgb(r,g,b),-1 
      
      DrawText 10,72,"Color c Components",Rgb(255,255,255)
      DrawText 10,10,"RED   " & r, Rgb(255,255,255)
      DrawText 10,26,"GREEN " & g, Rgb(255,255,255)
      DrawText 10,42,"BLUE  " & b, Rgb(255,255,255) 
      
      k = Canvas_GetPixel 320,360
      r = GetR(k)
      g = GetG(k)
      b = GetB(k)    
      Canvas_Ellipse 380,200,80+380,60+200, Rgb(r,g,b),-1 
       
      DrawText 300,72,"Color k Components",Rgb(255,255,255)
      DrawText 300,10,"RED   " & r, Rgb(255,255,255)
      DrawText 300,26,"GREEN " & g, Rgb(255,255,255)
      DrawText 300,42,"BLUE  " & b, Rgb(255,255,255)
      
      Canvas_Redraw
      Sleep 10
      
    Wend
    Canvas_Window End
    
    Uses "ui"
    #INCLUDE "api.inc"
    #INCLUDE "bass.inc"
    
    
    DWord hdc, hwnd
    hwnd=Canvas_Window("Music",100,100,640,480)
    Canvas_Attach(hwnd,0,%TRUE) 
    Canvas_Font("verdana",16,%CANVAS_FONTSTYLE_BOLD)
    
    
    Canvas_Clear(Rgb(0,0,255))
    InitBass()
    
    
    Long music = LoadMusic("music/g.mod")
    PlayMusic(music)
    
    
    DrawText 176,100,"Playing Skogens Djur",&hFFFFFF 
    
    
    Canvas_Redraw
    Canvas_WaitKey              
    FreeBass
    Canvas_Window End hwnd
    
    Attached Files Attached Files

Similar Threads

  1. ABC Update
    By peter in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 24-11-2013, 20:22
  2. Hi all ,you should update your SMF
    By hackchasers in forum General
    Replies: 1
    Last Post: 03-12-2009, 08:54
  3. Forum update to SMF 1.1.6
    By ErosOlmi in forum Web and Forum
    Replies: 2
    Last Post: 10-09-2008, 06:34
  4. Update from August 11
    By Petr Schreiber in forum Legacy
    Replies: 4
    Last Post: 15-08-2008, 04:53

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •