Qbasicnews.com
February 23, 2020, 07:50:23 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: INP() keyboard handling  (Read 9691 times)
jony_basic
Member
*
Posts: 35


WWW
« on: December 05, 2005, 02:28:50 PM »

I am working on a game in QB 4.5 and I would like to make a multy key function.
I tried some ASM things like fastkey.bas, but they didn't seem to work well on my machine.
then I heard from source (http://faq.qbasicnews.com/?blast=ChrTwo) in Qbasicnews.com that says I can use INP(96) for keyboard input.
If I can get key press and key realease, I can do some sort of multykey, if there is another way, that would be great too.
your help is very much appreciated.

Jony_Basic
Logged
red_Marvin
Na_th_an
*****
Posts: 1509



WWW
« Reply #1 on: December 05, 2005, 03:54:08 PM »

While I can't really remember any solid facts for the moment,
you could always fool around and educate yourself with this code:
[syntax="qbasic"]dim theinput as integer, oldinput as integer
do
  theinput=inp(96)
  if theinput<>oldinput then
    print theinput
    oldinput=theinput
  end if
loop[/syntax]
Logged

/post]
jony_basic
Member
*
Posts: 35


WWW
« Reply #2 on: December 05, 2005, 10:21:47 PM »

Thanks a lot for this, I will try a few things out with it.
I got an assembly multikey sub to work though, it seams to work fine for now. :oops:

Thanks again

Jony_Basic
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #3 on: December 06, 2005, 06:27:30 PM »

wats the code you used, im just wonderin, a multi-key system would be nice
Logged
Anonymous
Guest
« Reply #4 on: December 07, 2005, 12:30:40 AM »

http://www.qbasicnews.com/abc/showsnippet.php?filename=KEYBOARD.ABC&snippet=30


for all newbs:

click on the "ABC" up by Qbasicnews.com on top of the screen. tons of code to give you examples (thank na_th_an)
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #5 on: December 07, 2005, 12:14:11 PM »

that text the link links to is a bit buggy, the little thing jumps, and really i don see wat its for
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #6 on: December 07, 2005, 12:19:02 PM »

I've used that code in many games. It works perfectly.

It's just a keyboard handler. You call it with the scancode of the key you want to test. Scancodes can be found in the QB help.

For example, to test if the UP cursor key is pressed you call MULTIKEY(72), as 72 is the scancode for the UP cursor key.

Code:
IF MULTIKEY(72) THEN
   ' UP is pressed
END IF
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
axipher
Ancient Guru
****
Posts: 544



« Reply #7 on: December 07, 2005, 08:05:56 PM »

well its just that when i used that code, the little object moved sometimes 1 space over and sometime jumped like 5
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #8 on: December 09, 2005, 05:42:23 AM »

That's an OS fault. That code reprograms the machine timer to get a higher frame rate, but that doesn't work right in Windows XP. In fact, no timing routine in a MSDOS program will work right in Windows XP.

Note that QB is a MSDOS compiler and you are not running it in MSDOS.

You can try Milo Sedlaceck's keyboard handler, it doesn't touch the timer:

http://faq.qbasicnews.com/?blast=MiloSedlaceckKeyboardHandler

Another solution I've used to have a fast pseudo-multikey "keyboard handler" (add tons of quotes :lol:) for simple games and programs is this:

http://faq.qbasicnews.com/?blast=AltCtrlShifs

If you use CTRL for left, ALT for right and SHIFT for jump, you got it Cheesy
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
axipher
Ancient Guru
****
Posts: 544



« Reply #9 on: December 09, 2005, 12:22:00 PM »

Thanks alot for the links, although I switched to fb for now, when I ran my program, the screen was 3 SCREEN 13 pixels off to the left and right of my screen, it worked on some computers ok, but with fb as the compiler, since it's not DOS, the screen is displayed properly.
Logged
jony_basic
Member
*
Posts: 35


WWW
« Reply #10 on: December 12, 2005, 08:13:38 PM »

I got fastkey to work now, it works well enough, and I regulated it fine too. Cheesy

you can see the game I'm putting it into at www.freewebs.com/jony_basic/screenshots.htm
it's an RPG "The Sword Of Arisan"

Thanks again for your help

Jony_Basic
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #11 on: December 12, 2005, 11:22:40 PM »

Looks pretty nice.  I'm trying it out right now.
Logged
Nemesis
Forum Regular
**
Posts: 118



« Reply #12 on: December 13, 2005, 02:41:31 AM »

Quote from: "jony_basic"
I got fastkey to work now, it works well enough, and I regulated it fine too. Cheesy

you can see the game I'm putting it into at www.freewebs.com/jony_basic/screenshots.htm
it's an RPG "The Sword Of Arisan"

Thanks again for your help

Jony_Basic


Checked out a couple of the screen shots...
the graphics suck  :barf: but, this dosen't mean the game, story, handling, etc..
Anyways, read up on some pixel art tutorials, here's a good place to start off with...

http://www.petesqbsite.com/sections/tutorials/graphics.shtml

Cya,

Nemesis
Logged
axipher
Ancient Guru
****
Posts: 544



« Reply #13 on: December 13, 2005, 12:00:20 PM »

The actual game graphics aren't bad for DOS, but the side bar with gold, etc. is so shitty, I don't even know where to start, although the border to each part is ncie with the fade into another color, but the play area shoyuld have a border too.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #14 on: December 13, 2005, 01:50:04 PM »

Quote from: "axipher"
The actual game graphics aren't bad for DOS


Pixel art quality is not limited by the operating system, that statement makes absolutely no sense.

IMHO, the main issue with those graphics is that they are oversaturated and there's too much contrast on backgrounds. Golden rules are always try to use less saturated tones and use less contrast in the backgrounds than in the sprites, for clarity.

Look at the professionals' work:



Left being the original picture, right being an oversaturated version. Which one looks better? The left one, colours are less saturated (easier on the eyes) and there's less contrast in the background and more definition in the sprites.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!