Ugh.

BlitzPlus Forums/BlitzPlus Programming/Ugh.

sswift(Posted 2004) [#1]
I wish I'd had some WARNING that all the standard input commands wouldn't work in Blitzplus the minute I create a window and exit graphics mode to blit to a canvas instead.

Now I have to code a way to emulate the behavior of the Blitz2D commands for getitng the mouse position and mouse clicks and such with the event based system. Argh.


pantsonhead.com(Posted 2004) [#2]
I guess we should put that in the WARNINGS section... ;)


sswift(Posted 2004) [#3]
Yes, ha ha.. :-)

I posted this not only to vent though, but as a warning to others. There's not enough information about how Blitzplus works yet out there, so there's a big learning curve as soon as you try to use any windows commands, and the help files don't have examples for some important commands, like the command to create a canvas, which has no example showing that the "group" parameter it wants, which you cannot set to 0, is really for you to pass it the pointer to the window you created it for.


pantsonhead.com(Posted 2004) [#4]
We could do with some more useful/well commented/quickstart tutorials. I have thought about doing this, but been put off by the volume of B3D stuff in the Tutorials sections.

Perhaps splitting the Tutorials sections similarly to the Archives so users looking for B+ code don't have to wade through oceans of B3D stuff, etc.

You can waste hours looking for that snippet of code you know is there somewhere...


Tracer(Posted 2004) [#5]
emulate?

MouseX([canvas])
MouseY([canvas])

Where [canvas] is your canvas variable.

Mousehit should work as usual.

Tracer


sswift(Posted 2004) [#6]
MouseHit didn't seem to be working, but it may have been that I did not know at the time that MouseX and MouseY have a new "canvas" paramater, and my clicking may have in fact been reading as outside of the grid in my game as a result because my window was positioned in the center of the screen not the top left corner.

I only found that out when I was actually coding the thing, and by then I'd already coded stuff to handle mousehit.

But thanks for reminding me to go back and test to see if I actually need that mouse hit handler code in there anymore.


Tracer(Posted 2004) [#7]
There's also an event that registers mouse clicks and returns them. I use that on my canvas stuff.

Tracer


Wooster(Posted 2004) [#8]
Beware! mouse-down event ($201) doesn't return mouse
position in EventX() and EventY(). For this, you need
the mouse-move event ($203). Demo of this........

mywindow=CreateWindow("Mouse Test",20,20,600,400)
mycanvas=CreateCanvas(0,0,600,400,mywindow)
SetBuffer CanvasBuffer(mycanvas)
quit%=False
Repeat
Select WaitEvent()
Case $203 ;mouse move
mx=EventX()
my=EventY()
Case $201 ;mouse down
Text mx,my,"Yes"
Text EventX(),EventY(),"No"
Case $803 ;user closed the window
quit=True
End Select
FlipCanvas mycanvas
Until quit
End


GregC(Posted 2004) [#9]
Adding a little to your code, I tried treating both case $201 and $203 equally and this is what I came up with. It seems to work the same. Am I missing something?

mywindow=CreateWindow("Mouse Test",20,20,600,400)
mycanvas=CreateCanvas(0,0,600,400,mywindow)
SetBuffer CanvasBuffer(mycanvas)
quit%=False
Repeat
Select WaitEvent()

Case $203 ; mouse move
mx=EventX()
my=EventY()

Cls
Text EventX()+10,EventY(),"\Case $203 mouse move/ mx= "+mx +" my= "+my
Text EventX()+10,EventY()+18,"\Case $203 mouse move/ EventX= "+EventX +" EventY= "+EventY

Text mx+10,my+36,"\Case $203 mouse move/ mx= "+mx +" my= "+my
Text mx+10,my+54,"\Case $203 mouse move/ EventX= "+EventX +" EventY= "+EventY

Case $201 ; mouse down
mx=EventX()
my=EventY()

Cls
Text EventX()+10,EventY(),"/Case $201 mouse down\ mx= "+mx +" my= "+my
Text EventX()+10,EventY()+18,"/Case $201 mouse down\ EventX= "+EventX +" EventY= "+EventY

Text mx+10,my+36,"/Case $201 mouse down\ mx= "+mx +" my= "+my
Text mx+10,my+54,"/Case $201 mouse down\ EventX= "+EventX +" EventY= "+EventY

Case $803 ;user closed the window
quit=True
End Select
FlipCanvas mycanvas
Until quit
End