MaxGUI and images

BlitzMax Forums/BlitzMax Beginners Area/MaxGUI and images

767pilot(Posted 2006) [#1]
I have created a space invaders game in blitz3D (2d game!) with a level editor. I am recoding this in blitzmax using MaxGUI for the level editor.

Questions.

If I create the frame for the level editor how do I go about actually drawing the level within the editor? ie I have a form with all the buttons/options to the left, I want the level to be displayed to the right, what would it be drawn onto using MaxGUI? With blitz3d I just drew a grid of squares and loaded an image into that selected square.

is it possible to load an image onto an object within MaxGUI? ie an imaged onto a command button? I am trying to figure out how to display the gfx within the level editor in MaxGUI.
Would it be something to do with canvas?

Thanks
Graham


Grisu(Posted 2006) [#2]
I recommend this bmx gui tutorial: http://www.blitzbasic.com/Community/posts.php?topic=54579

It is impossible to load images onto normal windows buttons.
Though you can you a listbox or toolbar.
Or you could use an image canvas to create your own "button(s)",

Depending on how big your level is, you'll probably need a scolling canvas. Means you display the level with a virtual "viewport" which is scrollable. The technique is also explained inside the tutorial:
http://www.2dgamecreators.com/maxgui/T13-Sliders.html


767pilot(Posted 2006) [#3]
Thanks for the reply

With a canvas can you specify a location x,y and then put an object on that canvas, ie a textbox in the middle of the canvas or use drawimage command to load a jpg or bmp?


CS_TBL(Posted 2006) [#4]
uh, don't mess up terms now :P
setgraphics canvasgraphics(yourcanvas)
; right here you can use the gfx commands
; each position-related gfx command has x,y commands and sometimes x2,y2 or width,height commands
; like:
; plot x,y
; drawrect x,y,w,h
; line x,y,x2,y2
; drawimage yourimage,x,y
flip

So, putting GUI gadgets on that canvas is not smart thing to do..


Grisu(Posted 2006) [#5]
TextField and Canvas are two different gadgets.
In most cases you should not put them on top of each other.

You can draw an image inside the canvas.
And check for the mouse to move over the canvas.
Then check for a mouseclick.
And display another image inside the canvas.
This way you get a image "button". <> Createbutton!

You can also use drawtext to display text inside the canvas.