MaxGui as game HUD?

BlitzMax Forums/BlitzMax Programming/MaxGui as game HUD?

Can it be used in this way? I would guess that it can't, but I'd
like to be sure. My biggest need is to have buttons that can
affect my programs in a fullscreen window, for example.
This is what will decide if I buy MaxGui or not.

depends on the game. MAXGUI has canvas controls and eventhooks.

Maxgui is in the demo version now. try it out

Yeah, I downloaded that and did those 3 tutorials assari
wrote. I was pleased. I can't complain about the quality of
MaxGui! But what concerns me is that you need "WaitEvent()".
This seems to make it impossible to have a game running in the
background while you have buttons in the foreground. Of
course I could be way off. (I hope I am!)

Is this what EventHooks do?

Try "PollEvent()" instead of "WaitEvent()" :)

Does the 'More Rockout' sample not come with the demo then?

Ah, "Pollevent()", good. But in any case, I'll have to see some sort
of implementation into a realtime game environment before I am fully
convinced. Does anyone have any links to a WIP that uses maxGui
in a game environment?

[edit]
The more Rockout demo doesn't have the buttons as part of
the gamespace, if you know what I mean. It's essentially a
game window with buttons on the outside.
Think of an Rts interface, for example. That is what I'd want.

You can parent gadgets to a canvas no problem...
(knocked up from the eventhooks tutorial)
' rendering a canvas using an EventHook based Applet Type

Strict

Type TApplet
	
	Field	window:TGadget
	Field	canvas:TGadget
	Field	timer:TTimer
	Field button:TGadget
	
	Method Render()
		Local x,y,width,height,t,i
		width=GraphicsWidth()
		height=GraphicsHeight()
		t=MilliSecs()
		SetBlend ALPHABLEND
		SetViewport 0,0,width,height
		SetClsColor 0,0,0
		SetOrigin width/2,height/2
		Cls
		For x=-width/2 To width/2 Step 2
			y=Sin(t*0.3+x)*height/2
			DrawLine 0,0,x,y
		Next
	End Method
	
	Method OnEvent(event:TEvent)
		Select event.id
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_TIMERTICK
			RedrawGadget canvas
		Case EVENT_GADGETPAINT
			SetGraphics CanvasGraphics(canvas)
			Render
			Flip
		End Select
	End Method

	Function eventhook:Object(id,data:Object,context:Object)
		Local	event:TEvent
		Local	app:TApplet
		event=TEvent(data)
		app=TApplet(context)
		app.OnEvent event	
	End Function
	
	Method Create:TApplet(name$)
		Local	a:TApplet
		Local	w,h
		window=CreateWindow(name,20,20,512,512)
		w=ClientWidth(window)
		h=ClientHeight(window)
		canvas=CreateCanvas(0,0,w,h,window)
		canvas.SetLayout 1,1,1,1
		
		button = CreateButton("test",50,50,100,20,canvas)
		
		timer=CreateTimer(100)
		AddHook EmitEventHook,eventhook,Self
		Return Self		
	End Method
	
End Type

AutoMidHandle True

Local	applet:TApplet

applet=New TApplet.Create("Render Applet")

While True
	WaitEvent
Wend


But it'd have to be done in a window tho, not fullscreen, but then again you could fake it with a borderless desktop size window :)

Ok, So I can get a reasonable result if I create the window like this:
window=CreateWindow(name,0,0,1280,1024,,window_tool)

It even covers up the taskbar like it should. Good stuff.
The major problem now is that you have to go with whatever
screen resolution the user is currently set to.

And I wouldn't know how to get the user's resolution data
from Windows via Blitz in order to make this work in the first place.

It's alright though. I can create my own button functions
well enough. There isn't any need for redundancy. I was
just wondering.


I wouldn't know how to get the user's resolution data
from Windows via Blitz



GadgetWidth(DeskTop()) and GadgetHeight(DeskTop()) will do the trick.

With a bit of API proding you could even set the screen resolution yourself :)

Well that's cool. All that's left is the "API prodding" so I can control
resolution.