Game GUI help

Blitz3D Forums/Blitz3D Beginners Area/Game GUI help

Weetbix(Posted 2006) [#1]
So if I wanted to make a GUI system for mainly games, it would have to be 3d based right?

So would my system involve something like creating quads using the addvertex function etc then positioning them somewhere infront of the camera and slapping on a .png texture with alpha?

Thanks in advance.


Matty(Posted 2006) [#2]
That would work fine, there are a number of 'gui libs' including one by sswift which I hear good things about that may make it easier. However the way you suggest would work fine, particularly if you only need basic gui functionality such as buttons/labels.


Weetbix(Posted 2006) [#3]
Ahh okay thanks for your help. So how would I go about positioning the mesh infront of the camera all the time?

Also, I'm having a little trouble referencing to a mesh created within a function. What I'm trying to do is use a function i created which would build a quad where you want etc , but i cant reference to the mesh outside of the function so I cant point the camera at it etc. So how do I make the created mesh referencable?


boomboom(Posted 2006) [#4]
just parent it to the camera.

But check out this:

http://www.x-pressive.com/SpriteCandy/


Weetbix(Posted 2006) [#5]
Thanks :P But this costs money doesnt it? and anyway I'm interested in creating my own HUD/GUI system .

Go any ideas on the function problem im having trouble with?


b32(Posted 2006) [#6]
Use "return mesh" at the end of the function.

Or make the mesh global.


Weetbix(Posted 2006) [#7]
Ahhhh! Thanks alot man , very helpful. But how do make the mesh global? you can't make something global inside a function , it doesnt allow it.


Stevie G(Posted 2006) [#8]
global skybox

function CreateSkyBox( parent = 0 )

   skybox = createcube()
   flipmesh skybox

end function


Stevie


Weetbix(Posted 2006) [#9]
Ah I see, but what if i was using a function like:



Where the name of the mesh being created is set by the user when the function is called?


(tu) sinu(Posted 2006) [#10]
you should just return meshname from the function and assign a handle to the function when called ie

global MyMesh = addbox(x,y,height,width,texture)

and in the function either reurn the newly created mesh or surface


Weetbix(Posted 2006) [#11]
Great that works , thanks for your help guys.


Weetbix(Posted 2006) [#12]
How do I scale a mesh but choose where to scale it from instead of in the middle? What im trying to do is use my HUD system to display bars such as health , and im doing this by creating another box which scales acording to the health.

Should I do it this way or should I directly draw onto a texture?


jfk EO-11110(Posted 2006) [#13]
You may use Positionmesh to set it's relative centerpoint. You may also use MeshWidth etc. to determine the wanted new position. You can also do this with FitMesh, it also allows to scale the mesh. Both will permanently alter the mesh.

For a Gui I would suggest to keep everthing as modular as possible. Design it in a way that minimizes the number of function calls to use it. EG:

One Function to create a Gui Element.
One Function to read its value
One function to set its value
One function to remove the Gui element

One function to render all gui elements

You should not be forced to use any gobals. It should be handled like this:

my_input=CreateFormInput(x,y,maxlen)
...
print FormInputText(my_input)


IMHO it's most flexible to use banks. You can create them dynamicly, without to define their structure in the code (like with types)

So you could use a bank handle as "my_input". In the first long you'd store what type of gui elemet it is (eg 1=input, 2=checkbox ...), in the second long you could store the mesh handle, then maybe x,y,z and so on, whatever you need, the protocol is up to you.

So when you free the element, you would do something like

mesh=peekint(my_input,4)
freeentity mesh
freebank my_input
my_input=0

And then you need a list of active gui gadgets. So when you create a new one, you would append it to the end of the list. when you remove one, you should delete it also from the list. It's a simple task to do this with an array, but using a type instead will make blitz do the indexing job for you and all you have to do is things like FOR EACH...


Weetbix(Posted 2006) [#14]
Thats very helpful, thanks alot for taking the time to explain it to me.


Boiled Sweets(Posted 2006) [#15]
I will say this just once. Get Sprite Candy. Yes it costs but you can create very GUIs very quickly that run very fast cos it's using 3d not 2d.


jfk EO-11110(Posted 2006) [#16]
Sprite Candy makes Guis? Thought it's for particles? Can it handle things like Textinput, Dropdown Menus etc?


Mustang(Posted 2006) [#17]
jfk:

http://www.blitzbasic.com/Community/posts.php?topic=61948

DL the demo and see it for yourself... BTW, *PARTICLE CANDY* is the lib for particles; *SPRITE CANDY* is for HUDs and (now) GUIs.


jfk EO-11110(Posted 2006) [#18]
ok, thanks.


j-man(Posted 2006) [#19]
SpriteControl by Jim Brown works perfectly well and is FREE and easy to use...
http://homepage.ntlworld.com/config/spritecontrol/spritecontrol.htm
I'm using it to make a FREE OS HUD Designer
http://jnoodle.com/bosgcs/HUD2.zip
to go with my FREE Game Creation System
http://www.blitzbasic.com/logs/userlog.php?user=8140&log=693

EDIT: This also just became FREE and looks very promising
http://www.winblitz3d.co.uk/