1. Arrow Keys

How would you program the arrow keys. Like if you were making a game how would
you make so that you can use the up arrow key to move up and so forth.

new topic     » topic index » view message » categorize

2. Re: Arrow Keys

Andy wrote:
> 
> How would you program the arrow keys. Like if you were making a game how would
> you make so that you can use the up arrow key to move up and so forth.

if platform() = LINUX then
        --key defines
up = 259  dn = 258  left = 260  right = 261  ENTER = 10  ESC = 27  SP =
        32
pgup = 339  pgdn = 338  home = 262  endd = 360  insert = 331  bksp = 263
        del = 330
F1 = 265 F2 = 266 F3 = 267 F4 = 268 F5 = 269 F6 = 270 F7 = 271 F8 = 272
        F9 = 273 F10 = 274 F11 = 275 F12 = 276
else
        --key defines wim32 / dos
up = 328  dn = 336  left = 331  right = 333  ENTER = 13  ESC = 27  SP =
        32
pgup = 329  pgdn = 337  home = 327  endd = 335  insert = 338  bksp = 8
        del = 339
F1 = 315 F12 = 316 F3 = 317 F4 = 318 F5 = 319 F6 = 320 F7 = 321 F8 = 322
        F9 = 323 F10 = 324 F11 = 325 F12 = 326
end if

integer key key = 0
while key != ESC do
	key = get_key()
	if key = up then
		--do stuff
	elsif key = dn
		--do different stuff
	end if
 end while


http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

3. Re: Arrow Keys

Chris Burch wrote:
> 
> Andy wrote:
> > 
> > How would you program the arrow keys. Like if you were making a game how
> > would
> > you make so that you can use the up arrow key to move up and so forth.
> 
> }}}
<eucode>
> if platform() = LINUX then               
>         --key defines
>         up = 259  dn = 258  left = 260  right = 261  ENTER = 10  ESC = 27  SP
>         = 32
>         pgup = 339  pgdn = 338  home = 262  endd = 360  insert = 331  bksp =
>         263 del = 330
>         F1 = 265 F2 = 266 F3 = 267 F4 = 268 F5 = 269 F6 = 270 F7 = 271 F8 =
>         272 F9 = 273 F10 = 274 F11 = 275 F12 = 276
> else
>         --key defines wim32 / dos
>         up = 328  dn = 336  left = 331  right = 333  ENTER = 13  ESC = 27  SP
>         = 32
>         pgup = 329  pgdn = 337  home = 327  endd = 335  insert = 338  bksp = 8
>         del = 339
>         F1 = 315 F12 = 316 F3 = 317 F4 = 318 F5 = 319 F6 = 320 F7 = 321 F8 =
>         322 F9 = 323 F10 = 324 F11 = 325 F12 = 326
> end if
> 
> integer key key = 0
> while key != ESC do
> 	key = get_key()
> 	if key = up then
> 		--do stuff
> 	elsif key = dn
> 		--do different stuff
> 	end if
>  end while
> 
> </eucode>
{{{

> 
> <a
> href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a>
> <a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a>
> <a
> href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a>

Hi forgot to add credits - Irv Mullins, Dave Cuny (and anyone else) Chris

http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

4. Re: Arrow Keys

Andy wrote:
> 
> How would you program the arrow keys. Like if you were making a game how would
> you make so that you can use the up arrow key to move up and so forth.

Ok, try again, Credits to Dave Cuny, and Irv Mullins from dialogs

global integer  up, dn, left, right, ENTER, ESC, SP,
                pgup, pgdn, home, endd, insert, bksp, del, tab,
                F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12        

if platform() = LINUX then               
        --key defines
up = 259  dn = 258  left = 260  right = 261  ENTER = 10  ESC = 27  SP =
        32
pgup = 339  pgdn = 338  home = 262  endd = 360  insert = 331  bksp = 263
        del = 330
F1 = 265 F2 = 266 F3 = 267 F4 = 268 F5 = 269 F6 = 270 F7 = 271 F8 = 272
        F9 = 273 F10 = 274 F11 = 275 F12 = 276
else
        --key defines wim32 / dos
up = 328  dn = 336  left = 331  right = 333  ENTER = 13  ESC = 27  SP =
        32
pgup = 329  pgdn = 337  home = 327  endd = 335  insert = 338  bksp = 8
        del = 339
F1 = 315 F12 = 316 F3 = 317 F4 = 318 F5 = 319 F6 = 320 F7 = 321 F8 = 322
        F9 = 323 F10 = 324 F11 = 325 F12 = 326
end if

integer key key = 0
while key != ESC do
	key = get_key()
	if key = up then
		--do stuff
	elsif key = dn
		--do different stuff
	end if
 end while

 


http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu