Results 1 to 2 of 2

Thread: Api Update

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

    Api Update

    Hello,

    once again api.inc
    open a canvas_window is easier now.

    we have now:
    OpenWindow( width, height )
    Drawline( x1, y1, x2, y2, color )

    examples:
    Uses "ui","math"
    #INCLUDE "api.inc"
    
    OpenWindow 640, 480
    Canvas_Font "arial",14, %CANVAS_FONTSTYLE_NORMAL
    
    Single angle, cx, cy, r, na 
    Long i, x, y
    angle=1 : cx=320 : cy=240 : r=50 
    
    Canvas_Clear 0
    Canvas_Redraw
    
    For i=0 To 20100
        r=Sin(angle/100) * 200
        na=((r*2*Pi)/3600) * angle
        x =(Cos(na / r)*r)+cx
        y =(Sin(na / r)*r)+cy
        DrawPoint x,y, 4, Rgb 255,255,150
        DrawPoint x,y, 2, Rgb 255,255,255
        angle += .5
    Next
    DrawText 256,0,"Easter Flower", &HFFFFFF 
    Canvas_Redraw
    
    While IsWindow(hwnd) And KeyDown(27)=0
       Sleep 10
    Wend
    Canvas_Window End hwnd
    
    Uses "ui"
    #INCLUDE "api.inc"
    
    OpenWindow 220, 200
    Canvas_Font "arial",16, %CANVAS_FONTSTYLE_NORMAL
    Randomize
    
    Long i 
    Canvas_Clear &HF0C0C0
    canvas_redraw
    
    For i=1 To 12 
        DrawLine 10,i*15,220,i*15, Rnd(255,16777215)
    Next
    
    Canvas_Redraw
    While IsWindow(hwnd) And KeyDown(27)=0
       Sleep 10
    Wend
    Canvas_Window End hwnd
    
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    Nice Mandelbrot.

    Uses "ui"
    #INCLUDE "api.inc"
    
    OpenWindow 400, 300
    
    Single cRe,cIm,newRe,newIm,oldRe,oldIm,z,moveX,moveY
    Long iMax,x,y,i,a
    
    cRe = -0.8 : cIm = 0.27015 : z=1 
    iMax=256  
    
    For x=0 To 400
       For y=0 To 300
          newRe = 1.8 * (x-400*.5) / (.5*z*400) + moveX
          newIm = (y-300*.5) / (.5*z*300) + moveY
          For i=0 To iMax
             oldRe = newRe
    	       oldIm = newIm
    	       newRe = oldRe * oldRe - oldIm * oldIm +cRe
    	       newIm = 2 * oldRe * oldIm + cIm
    	       If((newRe * newRe + newIm * newIm) >5) Then Exit For
          Next
          Canvas_SetPixel x, y, i*45 + i*256 + (i*45)*65536 
       Next
    Next
    Canvas_Redraw
    
    While IsWindow(hwnd) And KeyDown(27)=0
       Sleep 10
    Wend
    Canvas_Window End hwnd
    

Similar Threads

  1. Api Update
    By peter in forum Sources, Templates, Code Snippets, Tips and Tricks, Do you know ...
    Replies: 0
    Last Post: 19-02-2014, 16:18
  2. 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
  3. Forum Update
    By ErosOlmi in forum Web and Forum
    Replies: 1
    Last Post: 17-06-2012, 00:49
  4. Hi all ,you should update your SMF
    By hackchasers in forum General
    Replies: 1
    Last Post: 03-12-2009, 08:54
  5. Forum update to SMF 1.1.6
    By ErosOlmi in forum Web and Forum
    Replies: 2
    Last Post: 10-09-2008, 06:34

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
  •