News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
drawing graphics in murgaLua
Author Message
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #1
RE: drawing graphics in murgaLua


Code:
--- concentric circles at mouse coordinates demo
--- mouse delta distance modifies circle height and width
windowHeight = 280
windowWidth = 320
centerx,centery=windowHeight/2,windowWidth/2
oldpointx,oldpointy=centerx,centery
counter = 96
lineStep=.1 -- increase for geometry
radiusStep=-.4 -- changes concentric density

function circles(cWidth,cHeight)
pi=3.14159
for ring=30,2,radiusStep do
radius=ring
C=2*pi

for cPoint=0,C,lineStep do
x=radius*math.cos(cPoint)*(cWidth/30)
y=radius*math.sin(cPoint)*(cHeight/30)
pointx=math.floor(Fl:event_x()+x)
pointy=math.floor(Fl:event_y()+y)
fltk.fl_loop(pointx,pointy,oldpointx,oldpointy,pointx,pointy)
oldpointx,oldpointy=pointx,pointy
end
end
end

function draw_callback(eventValue)
      fltk.fl_color(96+counter)
      w:make_current() -- whats this?
      flmousex=math.abs(oldpointx-Fl:event_x())
  flmousey=math.abs(oldpointy-Fl:event_y())
      circles(flmousex,flmousey)
         counter=counter+2
     if counter > 128 then counter=2 end
end

w=fltk:Fl_Window(0,0, windowWidth, windowHeight, "circles demo")
w:callback(draw_callback)
w:color(55)
w:labelsize(9)
w:show()

while (Fl:event_key() ~= fltk.FL_Escape)  do
    Fl:check()
     w:do_callback()
murgaLua.sleep(35)
end

This post was last modified: 01-06-2014 11:37 PM by iGame3D.

06-25-2007 03:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
drawing graphics in murgaLua - widged - 06-05-2007, 11:01 PM
RE: drawing graphics in murgaLua - mikshaw - 06-06-2007, 02:00 AM
RE: drawing graphics in murgaLua - mikshaw - 06-23-2007, 06:00 AM
RE: drawing graphics in murgaLua - mikshaw - 06-23-2007, 12:38 PM
RE: drawing graphics in murgaLua - mikshaw - 06-23-2007, 01:02 PM
RE: drawing graphics in murgaLua - iGame3D - 06-25-2007 03:29 PM
RE: drawing graphics in murgaLua - iGame3D - 06-25-2007, 08:11 PM
RE: drawing graphics in murgaLua - iGame3D - 06-25-2007, 08:25 PM
RE: drawing graphics in murgaLua - mikshaw - 06-27-2007, 12:21 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: