Qbasicnews.com

Full Version: QB Graphics for FB, preview release with source code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Quote:
Code:
PEEK (VARPTR(sprite%(0))+offset%)

doh!
Quote:
Marcade Wrote:Can InkeyTest.exe handle the arrow keys?

For all four keys, it returns CHR$(255) + the CHR value of the previous key for me. Sad
Wow, I don't know what would make to do that... what happens if the first key you press is an arrow key?

Then the second one just returns a zero Sad

I have Windows XP SP2 on an Athlon desktop.
Quote:Then the second one just returns a zero :(

I have Windows XP SP2 on an Athlon desktop.
Same here (XP SP2, Athlon XP). Hmm... returns zero as in, Getkey returns zero, or Inkey$ returns "0" or "", or what?
Quote:
Marcade Wrote:Then the second one just returns a zero Sad

I have Windows XP SP2 on an Athlon desktop.
Same here (XP SP2, Athlon XP). Hmm... returns zero as in, Getkey returns zero, or Inkey$ returns "0" or "", or what?

When I start the Inkey program that came in your zipfile and immediately start pressing any of the arrow keys, I get:

CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)
CHR$(255) + CHR$(0)

:|
Marcade: What happens when you run this and press keys?
Quote:Marcade: What happens when you run this and press keys?

Then I see a lot of stuff :-)

But the interesting part is, now I do see a difference when pressing keys

The up key: CHR$(255) + CHR$(200) (Scancode: 200; SDLKey: 273)

The down key: CHR$(255) + CHR$(208) (Scancode: 208; SDLKey: 274)

The left key: CHR$(255) + CHR$(203) (Scancode: 203; SDLKey: 276)

The right key: CHR$(255) + CHR$(205) (Scancode: 205; SDLKey: 275)
Darn. I guess this means I can't count on scancodes always being the same on different computers. At least the SDL key code is the same... I'll just have to use that instead. Arg, what a pain. It means a lot more code or a huge lookup table.

Are F1-F12, Insert, Delete, PageUp, PageDown, Home, or End giving stange results too?

EDIT: There was also a bug in InkeyTest.bas, that's why it was showing the last keypress :oops:, it's fixed now, but I'll still have to rewrite my Inkey code.
Quote:Darn. I guess this means I can't count on scancodes always being the same on different computers. At least the SDL key code is the same... I'll just have to use that instead. Arg, what a pain. It means a lot more code.

Are F1-F12, Insert, Delete, PageUp, PageDown, Home, or End giving stange results too?

Well I don't know what's 'strange' .. like if they'd be different on another computer. I only know they do give a different results.

Only my arrow keys were doing nothing. Smile
Quote:Only my arrow keys were doing nothing. :)
That's a bug in InkeyTest.bas. The next version of the library will have an Inkey that should work on your computer.

By strange I meant different from QB's INKEY$.
eh? i tried a pixel test in fb and qb... screen 13, draw as many pixels as they can. qb used poke, fb used pset.

qb (compiled) 10000+
fb: 400 max

note that fb is also flipping every loop as well... but how come it's running so slowly?

just so you have it, here's my code. Probably some no-no i'm doing wrong. like maybe using timer?

Code:
'$include: "qbgfx4fb.bi"
redim fps as string
screen 13
t! = timer
randomize timer
do

fps = str$(count / (timer - t!))
locate 1,1
gfx_Print fps

pset int(rnd * 320), int(rnd * 240), int(rnd * 256)

count = count + 1
flip
loop until len(inkey$)
Pages: 1 2 3 4