Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mouse in DOS?
#1
Can I use the built in FreeBasic Mouse functions when running my program in Pure DOS?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#2
Only if you are in a graphics mode (set with SCREEN); that requires the gfxlib, which is not finished in the DOS port (and is only available from the CVS for now). If those conditions are met, it'll work just the same as in the Windows version of FreeBASIC.
Reply
#3
So at the moment I cannot do it?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#4
Actually you can - you just won't be using FB's commands. The easiest way I can think of would be to use inline assembly to get input from the mouse. I'm not really certain though how to do that in 32-bit. Under 16-bit, you'd simply tie into interrupt 33h. :wink:
Reply
#5
What will I be using then, if I'm not using FB's commands?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#6
Interrupts, just like you would in QB
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)
Reply
#7
Hmm... Could I be pointed to a tut that explains these "Interupts"?
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#8
Not exactly a tutorial (you should be able to find billions of them, everybody seems to think he has the greatest mouse routine ever Smile ), but here's a simple bit of code:
Code:
option explicit

#include "dos/dpmi.bi"

#define MOUSE &H33

dim regs as __dpmi_regs
dim x as integer, y as integer, b as integer

width 80, 25

for y = 1 to 25
    for x = 1 to 80
        locate y, x
        color int(rnd * 16)
        print chr(176);
    next x
next y

' turn off text cursor
locate , , 0

' initialize mouse
regs.x.ax = 0
__dpmi_int(MOUSE, @regs)

' show mouse
regs.x.ax = 1
__dpmi_int(MOUSE, @regs)

do until len(inkey)
    ' get mouse position
    regs.x.ax = 3
    __dpmi_int(MOUSE, @regs)
    x = regs.x.cx \ 8 ' divide by 8 - char width = 8
    y = regs.x.dx \ 8 ' divide by 8 - char height = 8
    b = regs.x.bx
    locate 1, 1
    print using "### ### //"; x, y, bin(b)
loop

' hide mouse
regs.x.ax = 2
__dpmi_int(MOUSE, @regs)

color 7, 0

cls
Reply
#9
Quote:Not exactly a tutorial (you should be able to find billions of them, everybody seems to think he has the greatest mouse routine ever ), but here's a simple bit of code:

Who are you refering to?[/b]
quote="Deleter"]judging gameplay, you can adaquately compare quake 4 with pong[/quote]
Reply
#10
Hey, kids! English lesson time! Smile 'Everybody' is singular; therefore, I couldn't say "Everybody thinks they have ...", but instead must use "Everybody thinks he has...", where 'he' refers to 'everybody' Smile In other words, everyone who writes a mouse handler thinks that the mouse handler he or she has written is uber-great etc. Big Grin

Does that code help you do what you want?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)