MaxGui required?

BlitzMax Forums/BlitzMax Programming/MaxGui required?

I have given it some thought. I need to have a number of icons (images) that can be selected, like gadgets, or menu selections etc. I guess i have several options;

first i can read the X/Y and see if the current coordinate is within each item's upper left and lowerright. That approach would work i think ...

on the other hand isn't that what MaxGUI is for? to free the coder from worring about reading each pixel positition?

i guess without MaxGUI i would have something like

pseudo ..
if x not within range
& y not within range
... mouse not over item

etc. for each item

For graphic accelerated gadgets, look for HighGUI 3 by Diablo :D

thats a good suggestion, but was i completely off above in regards to not using any plugin or applet? is that how most of you experienced users do? just check the X/Y constantly? I know of Maxgui but never heard of HighGui 3?

That sounds about right, if you were making your own GUI.

But MaxGUI is actually just a wrapper and interface for the system's native GUI. So in Win32 MaxGUI wraps and simplifies Win32GUI, in MacOS it does Cocoa, and in Linux it does FLTK. (FLTK is the only GUI in there not native to the system.)

Also, there are no real differences to the code on any platform, a very nice feature.

And in case you wondered, yes you can create a Max2D graphics context in a MaxGUI window, but it requires a teeny bit more work.

Another good graphic accelerated GUI is FryGUI.

Can MaxGui run fullscreen? so if the player wanted Windowed mode he would see the Win32 gadgets etc. but if the player chooses fullscreen its like not using MaxGUI at all?

No, GUI application can due to their nature and their own restrictions, not run fullscreen.

If you want fullscreen, using graphics is the way.
For windowed, either graphics or a Window with a canvas (if it is only a game I think I would prefer graphics here as well)

If you don't need other gadgets, there is no reason you would need maxgui, the events for applications and input are usable without maxgui after all.

I am wrapping my beginner brain around this ...
i cant seem to get it to work, the checking within a range for the mouse ...

like as in

(check to see if mouse is over specific area) say X/Y 10,10 W/H 300, 300

if mousex() > 10 and mouseY() > 10
bla bla bla
is a CASE better? it cant be surely?

I might be able to use imagecollide() :-)

Yes and if you use a specific layer where only GUI is drawn in you will most likely never need to redraw the collision (draw GUI only with write, but make sure they do not read collision, when checking for which gadget you are in, use rect collision ad mouse position with size 1,1 but do only read collision, not write)

Actually Imagecollide() WORKS! the only problem is that they collide when their "edge" touch, not their centre of each one? any ideas for that? But Imagecollide() works fine!

Colliderect?
And this might help :
SuperStrict
Type trect
	Global list:tlist=CreateList()
	Field x:Int
	Field y:Int
	Field w:Int
	Field h:Int
	Field r:Int
	Field g:Int
	Field b:Int
	Function Create(x:Int , y:Int , w:Int , h:Int)
		Local temp:trect = New trect
		temp.x = x
		temp.y = y
		temp.w = w
		temp.h = h
		ListAddLast list , temp
	End Function
	Function rectdraw()
		For Local all:trect = EachIn list
			all.draw()
		Next
		SetColor 255,255,255
	End Function
	Method draw()
		SetColor r , g , b
		DrawRect x , y , w , h
	End Method
	Function colrect(x:Int , y:Int , w:Int , h:Int)
		Local numcol:Int
		For Local all:trect = EachIn list
			Local hit:Int = all.checkcol(x , y , w , h)
			If hit numcol:+1
		Next
		SetColor 255,0,0
		DrawText "There have been : " + numcol + " collisions" , 0 , 0
		SetColor 255,255,255
	End Function
	Method checkcol:Int(xpos:Int , ypos:Int , width:Int , height:Int)
		If xpos > x And xpos + width < x + w And ypos > y And ypos + height < y + h
			r = 255
			g = 0
			b=0
			Return 1
		Else
			r = 255
			g = 255
			b=255
			Return 0
		EndIf
	End Method
End Type
Graphics 640 , 480
SeedRnd MilliSecs()
For Local loop:Int = 0 To 10
	trect.create(Rand(0 , 540) , Rand(0 , 380) , 100 , 100)
Next
While Not KeyHit(KEY_ESCAPE)
	Cls
	Local mx:Int = MouseX()
	Local my:Int=MouseY()
	trect.rectdraw
	trect.colrect(mx - 1 , my - 1 , 2 , 2)
	Flip
Wend


on the other hand isn't that what MaxGUI is for?
No.

the only problem is that they collide when their "edge" touch, not their centre of each one? any ideas for that?
What tonyg said. Otherwise use a different image for collision checking than the one you actually draw.

I highly recommend FryGUI. Very simple to use and set up screens, and it works like a charm.