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 
PONG
Author Message
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #1
RE: PONG

What speed of processor and video card are you guys working on?
I'm on 2Ghz and 128MB graphics card with unknown refresh rate.
Tested on 1.5Ghz and there wasn't really a difference.

Its really smooth here.
Any glitching from this script?
It simply has a 'ball' that follows the mouse around.
Does it go glitchy if you comment murgaLua.sleepMilliseconds(10)?

Code:
math.randomseed(os.time())
-- mouseBall
function mouseBall()
-- move the ball
bx,by = Fl:event_x(),Fl:event_y()
Ball:resize(bx,by,16,16)
end

function playMBall()
if (Fl:event_text()== "q") then os.exit() end
  mouseBall()    
  MBall:redraw()    
  murgaLua.sleepMilliseconds(10)
end

function MBallWindow_CB()
if (Fl:event_key()== fltk.FL_Escape) then playGame=not playGame end
    if playGame == true then
    MBall:label("MBall")
    else
    MBall:label("MBall  (PAUSED)")
    end
end
do MBall= fltk:Fl_Double_Window(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "MBall")
MBall:label(gLabelTable[#gLabelTable])
MBall:callback(MBallWindow_CB)
MBall:resize(380,194,652,443)
MBall:color(0)
do Ball= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "@-9square")
Ball:label(gLabelTable[#gLabelTable])
Ball:resize(320,226,15,16)
Ball:labelsize(50)
Ball:labelcolor(95)
end
end
MBall:show()
MBall:make_current();
while MBall do
Fl:check()
playMBall()    
end
Fl:run()



Mouse tracking is definitely not in sync.
If I turn off automatic window redrawing the ball can draw many pixels away from its last position between mouse moves.
Depends on how quickly you flick the mouse around really.
Oddly I get a different sized ball depending on if the window is redrawing or not.

Code:
function playMBall()
if (Fl:event_text()== "q") then os.exit() end
  mouseBall()
Ball:redraw()    
--this toggles window redraw, hit any other key to stop redrawing
   if (Fl:event_text()== "r") then MBall:redraw() end
--i see no effect from this, do you?
murgaLua.sleepMilliseconds(10)
end

This post was last modified: 04-22-2010 03:10 PM by iGame3D.

04-22-2010 02:19 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
PONG - iGame3D - 04-21-2010, 10:37 PM
RE: PONG - mikshaw - 04-22-2010, 01:05 AM
RE: PONG - iGame3D - 04-22-2010, 04:56 AM
RE: PONG - mikshaw - 04-22-2010, 06:26 AM
RE: PONG - jpjacobs - 04-22-2010, 08:26 AM
RE: PONG - iGame3D - 04-22-2010 02:19 PM
RE: PONG - mikshaw - 04-22-2010, 03:08 PM
RE: PONG - jpjacobs - 04-22-2010, 03:25 PM
RE: PONG - iGame3D - 04-22-2010, 06:20 PM
RE: PONG - mikshaw - 04-23-2010, 06:04 AM
RE: PONG - iGame3D - 04-23-2010, 07:24 AM

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

Forum Jump: