02-19-2005, 02:15 PM
Himeowth!
I have modified the keymouse.bas programm so that it show a better way to retrive keyboard input for games. Have fun and dont give up coding
(How to tag this as qbasic code? I have seen it somewhere but dont know how)
So Long, The Werelion!
I have modified the keymouse.bas programm so that it show a better way to retrive keyboard input for games. Have fun and dont give up coding
Code:
''
'' SDL events test
'' by marzec
'' modified by BastetFurry for showing how to grab game input
''
'$include: 'SDL\SDL.bi'
declare sub DoKeyPrint ()
declare sub doInit ( )
declare sub doQuit ( )
declare sub doMain ( )
declare sub exitError ( msg as string )
dim video as SDL_Surface ptr
dim shared event as SDL_Event
doInit
doMain
doQuit
sub doInit ( )
if(SDL_Init( SDL_INIT_EVERYTHING )) then exitError "couldn't init SDL"
video = SDL_SetVideoMode ( 320, 200, 24, SDL_HWSURFACE )
if( video = 0 ) then exitError "couldn't init videomode"
end sub
sub doMain ( )
dim keysdown as Integer
dim quit as Integer
quit = 1
print "-----------------------------------------------"
print " SDL TEST"
print "-----------------------------------------------"
while( quit = 1)
if keysdown = 1 then DoKeyPrint
while( SDL_PollEvent ( @event ) )
print "event happened, type:" + str(event.type)
select case event.type
case SDL_KEYDOWN:
keysdown = 1
case SDL_KEYUP:
keysdown = 0
case SDL_MOUSEBUTTONDOWN:
print "mousebutton pressed, quitting"
quit = 0
end select
wend
wend
print "leaving doMain"
end sub
sub DoKeyPrint ()
SDL_PollEvent ( @event )
print "key event, pressed key:" + str(event.key.keysym.sym) + " " + chr$(event.key.keysym.sym)
print
end sub
sub doQuit ( )
print "quiting"
SDL_Quit
end sub
sub exitError ( msg as string )
print "error: " + msg
SDL_Quit
end
end sub
(How to tag this as qbasic code? I have seen it somewhere but dont know how)
So Long, The Werelion!
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]