Some (REAL) basic questions on gui, im a noob

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Aethaecyn

Some (REAL) basic questions on gui, im a noob

Post by Aethaecyn »

Suppose you could have inferred i'm a noob being im posting in the beginners help forum.

Anyway i'm not too good at figuring things out from scratch but rather by example so I'm trying to figure out in a program like the 5. User Interface Example if there is some sort of a clearscreen command for within a window, like say instead of when you click on the 2nd button that pops up the window if instead of making the new window instead when you clicked it it would clear everything off the current window, and display some text and a new button which you would click to return to the former window..

all i need to know is how i would clear the window of the mess on it... just hoping i'm understood

in iguistatictext.h it says ~IGUIStaticText() {}; but i'm afraid i dont know what to put in the brackets or if that's even what im looking for, thanks in advance, if there is a thread on this already sorry =(
Aethaecyn

Post by Aethaecyn »

Wow this site is horridly laggy right now, oh well don't suppose i'm missing out on anything since people never answer my questions anywhere... pardon my impatience..

Anyway if you cannot answer the above question, then I have another, how the heck do i make an edit box work? It says IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(environment, parent, id, rectangle) {}

and I have no idea what that means, do i replace the word environment and or parent after the *'s and what are the valid choices for that position, I don't know what I can put there, do i put it in the same format as the other things that are being put in in 5. such as the scrollbar because it doesn't work when you do for isntance just guessing
IGUIEditBox* editbox = env->addEditBox(rect<s32>(10,10,98,41));

like that with editbox instead of scrollbar doesn't seem to do mess at all so i'm rather confused as to how i get any of this working, i need an example please someone
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

I'm having trouble following what your asking, but here goes:

~IGUIStaticText() {} is a destructor. You don't need to call it as it gets called when the element is removed.

"in iguistatictext.h it says" - There isn't a need to modify the Irrlicht engine code unless you need to, reading the documentation is way easier.
Anyway i'm not too good at figuring things out from scratch but rather by example so I'm trying to figure out in a program like the 5. User Interface Example if there is some sort of a clearscreen command for within a window, like say instead of when you click on the 2nd button that pops up the window if instead of making the new window instead when you clicked it it would clear everything off the current window, and display some text and a new button which you would click to return to the former window..
Not for a window, but for the contents of the window. Combo Boxes and List boxes have a .Clear() function.

Anyway if you cannot answer the above question, then I have another, how the heck do i make an edit box work? It says IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
: IGUIElement(environment, parent, id, rectangle) {}

and I have no idea what that means, do i replace the word environment and or parent after the *'s and what are the valid choices for that position, I don't know what I can put there, do i put it in the same format as the other things that are being put in in 5. such as the scrollbar because it doesn't work when you do for isntance just guessing
IGUIEditBox* editbox = env->addEditBox(rect<s32>(10,10,98,41));

like that with editbox instead of scrollbar doesn't seem to do mess at all so i'm rather confused as to how i get any of this working, i need an example please someone

Use the IGUIEnvironment->addEditBox function.
Parent is the element you are attaching it to, 0 for none.
ID is what you refer to it as.
Crud, how do I do this again?
Aethaecyn

Post by Aethaecyn »

Thank you very much, =)!

No I wasn't editing the .h's, I was just trying to look through them for what the commands are, hehe.
Aethaecyn

Post by Aethaecyn »

Umm, it seems to be that when I type IGUIEnvironment->addEditBox it says parse error before -> token... bleh I give up on gui i think i feel as though I'm too stupid for it.. going to have to stick with DOS progs I guess at least those make sense..
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

You have to make a pointer to the IGUIEnvironment... I suggest you first follow some tuts on C++ before working with this engine.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Rocketeer
Posts: 9
Joined: Sun Jul 11, 2004 9:13 am
Contact:

Post by Rocketeer »

The tutorials on the main site are very good, there is one on the GUI environment...

There's also the API documentation, which (in my opinion) is a lot better than the headers for working out how to use this all :wink:

API Docs: http://irrlicht.sourceforge.net/docu/index.html
Tutorials: http://irrlicht.sourceforge.net/tutorials.html
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

I know what he is asking and I have the simplest answer.
There is no clear button for the main window.

You can change the content or open and close more windows within it but if you want the main window to change you have to destroy it and create a new one. (And I would very much like to know how thats done)

I'm currently working on an all Graphical User Interface GUI game.
I'm not going to go into what the game is about but I will say that I'm working hard on learning the code and using irrlicht itself to teach me c++.

now the reason I don't go read one of the million tutorials (which I do at great length in fact I've been staring at the code for 5 hours now and skimming c++ tutorials) is because they bore me to death and like you I learn better by example although I wouldn't recommend following me down this trail. I'm a fast learner thats all I pick up on it piece by piece.

I'll be honest I don't much like coding because of the complexity.
But I very much want to get my models and my ideas into a working game and have to do it alone.

In the 5 hours I spent today (so far) I already have basic understanding how the code works and I havent even gotten into object oriented programming yet in C++ tutorials. which is basicly what I'm learning today (sorta..I think lol) but the point is I knew almost nothing and probably don't know much more then you right now Aethaecyn. But I can create some very basic gui commands.

I learned some of the commands by looking at the gui interface example and the meshviewer the 2 combined have all the basic gui commands. (most anyways)

It only gets complex when you want to make things happen my best advice because I'm lost in the same dark hole you are is to read alot of c++ tutorials and learn how this all works.

the main problem with learning C++ from Irrlicht code is that everything you make runs through Irrlicht and most of what you can do is just calling up commands from the core of the engine. it gets pretty confusing when you just want to add a window or box here and you need to understand.

basicly gui in Irrlicht works like this: (this is very basic understanding correct me if you like)
GUIEnvironment is all the GUI in the main window basicly it is the main window at least for handling gui
GUIElement is some form of grouping GUI elements (or something not really sure about this one)
Everything else falls under these like:
GUIListbox
GUICombobox
Ect..
Because they are only basic GUI elements based on "windows style" programs (I guess) drop down menu's windows with tabs all the good stuff.
you can also make images into buttons and the whole works by using basic C++ loops and commands.

try the 2-3 gui examples for the easy stuff and try to understand how it works and read more C++ tutorials.

The ONLY problem with crossing the vally is that you must first build the bridge.

If it's example you want then get some C++ source code. then maybe the tutorials won't bore you to death. (and one of these days I'll take my own advice)

I've put a link to the source I've been working on today maybe it will help.
It might seem very raw but might help you understand the basic functions better. It's just main.cpp for the GUI example program all hacked up and customized.

If you can figaure out how to get it into your compiler and compile and run it then I'd say you have a very basic understanding of C++ and are off to a good start.

don't ask me about this if it works for you then great otherwise go take a C++ hello world tutorial.

I even took the time to go into detail using comments in the code.
anyone should be able to understand this after taking a C++ hello world tutorial that goes for getting it into your compiler aswell.

and if you have read the hello world tutorial for C++ (not Irrlicht's hello world tutorial) and spent at least 5 hours looking and rereading my examples and still don't understand anything at all then yes you ARE too dumb to understand this..lol..or maybe you are very new and need to not mess with things like this without learning the basics.

I spent 3 hours writing this post and refining the code and comments I consider this noob proof and if you have questions about it you can ask but I probably won't answer. unless it's important and I get around to it. I'm basicly showing you everything I know right now so questions would be pointless.

phew out of breath and with that here is a link to the source.

Midnight's Irrlicht GUI Tutorial.rar
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

To destroy and recreate a device. Read the code for the tech demo. Get attributes, drop device then immediatly create a new one. Job done. I don't know whether this also drops all the other pointers you have like the scene manager, you will have to try this one out but that is the way to do it.

To clear the screen you are currently on and move on to another screen, what I do is load all possible screens from the start and then hide all the elements. Then I show the elements of the screen I want and keep hiding and unhiding as I go from screen to screen.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

thanks for the tip

I actually thought about the techdemo problem is I didn't know if that would work for me I havent taken a look at the code yet but I want to go from gui to gui window in the most seemless way and I'm not sure the techdemo is a good example of that but I like your idea then it's all preloaded and stuff.

I'm working on an all or mostly gui game that will have many of these switches and changes. problem is some of the things I need I think I'm going to have to make myself and that could take awhile.

I picked up a few tools that should help me along though once I do figuare out this kinda thing.
Post Reply