Blitzmax game window whit menus and tools editor

BlitzMax Forums/BlitzMax Beginners Area/Blitzmax game window whit menus and tools editor

RedWizzard(Posted 2016) [#1]
Hi all,

I have been looking around the internet trying to find how i make a
top menu whit buttons and file/edit select for my editor.

I have created a editor for my game using the basic blitzmax game window.
I would like to make menus whitin that window so you can select the objects,
your filename for saving the game map and such.

I have had no luck whit max gui but i did made a small "savegame/loadgame"
window when i start my programm i found the MaxGui window was seprated from the blizmax main game/flip window.

I tried using a canvas whit my editor code it worked a bit but the canvas itself was way to small and the basic blitzmax flip window was still there all black.

then i added my editor programming whit in the maxgui canvas example
i got it to work a bit. the window was shifted to the down right
and did not respond to any of my inputs from my mouse or the keyboard

All i realy want is to use the maxgui controles in my main window.
so you get the editor programm along whit a top menu/tools and side menu for object place ment.

so is there a way that i can add the maxgui stuff in my basic blitzmax window?

Hope you all can help me out here.
Greetings Gijs de Mik


Midimaster(Posted 2016) [#2]
Of course! MaxGui works perfect together with BlitzMax stuff. Have a look on my education software. There you can see menues, second windows, canvas and rows of buttons beside the canvas.

All you need it a kind of "wrapper" around your code. Some users already asked in this direction. Here is a typical thread:

http://www.blitzbasic.com/Community/posts.php?topic=98213#1146136


Here I copied some lines of a typical beginning of my software. The main loop does not longer include FLIP, but it is around the EVENTS. FLIP and canvas actions are inside the MALEN function which is called by an GUI event. Hope it helps:


Do you need more than one window? I isolate each window in a TYPE and the main loop calls the corresponding function depending on which window is active.


RedWizzard(Posted 2016) [#3]
This is awesome MIdimaster.
I will chek out the code in bltizmax using my current editor prgramming.
As i can see here al i need to do is paste that into the malen function.

Just the right thing i was looking for.

I am going to programm again tommorw but from the looks of the code
it will go smootly.

It would be cool to have a objects window on the rightt.
wich hold the game objects(my game is gridbased)

Small question can i if i make a new MDI2 type can i call it from
your MDI type? wat if i add a menu item to MDI
and set it up like this (short quick code)

Type MDI2 (objectsbrowers window stuff)

'code for a popup window that has the  game objects inside for paste select.

'adding this to the MDI type

Type MDI
~~ Menus[ObjectBrowser]=Createmenu ~~
Case MENU_ObjectBrowser
.MDI2
End select ~~ 


I understand the Malen fucntion. So if i make 2 more types (type MDI_B/MDI_C)
i add
Local Fenster:Tgraphics=CanvasGraphics(mid.canvas)

Local Fenster:Tgraphics=CanvasGraphics(mid_b.canvas)
code
Local Fenster:Tgraphics=CanvasGraphics(mid_c.canvas)
code


It should load the 3 gui windows.

I haven used types or methods yet in my programm.
Thanks for the info MidiMaster.


RedWizzard(Posted 2016) [#4]
So ive got the maxgui working whit the main bliztmax gameloop / grapics
I ended up using this code, I thougt i should post it here so other can find help about the topic to.

I could not realy get midimasters code to work but it did gave me help how it could be done


EnablePolledInput() 'This is handy use this to get "normal" mouse input on your gui

Global GAME_WIDTH=1370
Global GAME_HEIGHT=768

' create a centered window with client size GAME_WIDTH,GAME_HEIGHT

Local wx=(ClientWidth(Desktop())-GAME_WIDTH)/2
Local wy=(ClientHeight(Desktop())-GAME_HEIGHT)/2

Global window:TGadget=CreateWindow("Wizzard editor 0.4",wx,wy,GAME_WIDTH,GAME_HEIGHT,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)

' create a canvas for our game

Global canvas:TGadget=CreateCanvas(0,0,GAME_WIDTH,GAME_HEIGHT-80,window)
Global canvasobject:TGadget=CreateCanvas(900,700,50,50,window)
'new gui
	Global textfield:TGadget
	Local button:TGadget
	Local button2:TGadget
	Local button3:TGadget
	textfield=CreateTextField(5,700,120,22,window)
	SetGadgetText( textfield,"FileName Here" )
	button=CreateButton("Save",5,730,80,24,window,BUTTON_PUSH)
	button2=CreateButton("Load",95,730,80,24,window,BUTTON_PUSH)
	button3=CreateButton("Exit Editor",170,730,80,24,window,BUTTON_PUSH)
' create an update timer

CreateTimer 60



InitMap
'**********************

SetGraphics CanvasGraphics(canvas)
SetBlend MASKBLEND
SetMaskColor 255,0,255
InitImages




While WaitEvent()
	Select EventID()
		Case EVENT_TIMERTICK
			RedrawGadget canvas
		
			
			MXZ= MouseX()/grid*grid
 			MYZ= MouseY()/grid*grid
 
		Case EVENT_GADGETPAINT
'Global C=1 
'If C=>1 Then If KeyHit(KEY_DOWN) C=C-1	 
'If C=<44 Then If KeyHit(KEY_UP)  C=C+1

C=Mousewheel(80)


UpdateFlp C '**The Function refferd to here is my main game/edtior loop 
                    '**Minimum function/loop code CLS , Do stuff , Flip 



		Case EVENT_MOUSEMOVE
		'C=C+1

			'Print "X"+MXz
			'Print "Y"+MYz
		
		Case EVENT_WINDOWCLOSE
			FreeGadget canvas
			End

		Case EVENT_APPTERMINATE
			End

	End Select
	
Select EventID()
	Case EVENT_GADGETACTION
		Select EventSource()
			Case textfield
				Case button
 				 StoreMap GadgetText$( textfield)
			Case button2
	 Loadmap 	'Function that loads my map
 
			Case button3
			End
	End Select
	End Select		
Wend