Dragon Warrior 1 3D Remake using irrWizard...

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

area51 -- Thanks. I'm a dork. I did not even noticed CGameManager inheriting IEventReciever until you mentioned it in your post. :shock:

But I still do not have a functional options screen like in my separate test build yet. I need to add code to handle the mouse clicks because when I tried to click on any of the GUI buttons, I don't see the button depressing or any of the button ids event being triggered. :x

Argh...I feel like I'm so close to getting the options working but there's this tiny piece missing that I can't quite grasp it yet. This problem is both frustrating (how long it's taking me so far) and intriguing (how fascinating the different issues one faces). :P
area51
Posts: 338
Joined: Thu Mar 18, 2004 10:20 pm
Location: UK
Contact:

Post by area51 »

Ah, OK. If you're using Irrlicht GUIButtons then you will need to add support in the game manager, as it doesnt at present support this:

Code: Select all

cGameManager::OnEvent(SEvent event)
...
if (event.EventType == EET_GUI_EVENT)
    {
        // Pass input down to the specific game state GUI handler
        m_pGameState->GUIEvent(this);
    }
and then add the GUIEvent() function to the CGameState.cpp & .h files:

Code: Select all

//! Implemented by subclass
//! GUI event for state, main GUI events
//! passed down by Game manager. 
void CGameState::GUIEvent(CGameManager* pManager)
{

}
then you can override that function in your CGameOptionsState class.

The GUIEvents should then be thrown down to this GUIEvent function by the CGameManager then.

The lack of GUI support was mentioned by Unarekin very early on, but I forgot to add it in, sorry for that.:D
________
ZX14 VS HAYABUSA
Last edited by area51 on Thu Feb 24, 2011 11:56 pm, edited 1 time in total.
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

area51 -- Thanks, but I had already added GUI support exactly like what you post to CGameManager several days ago. The problem I had was whenever I try to press a button, the button would not press.

I found out why just a couple of minutes ago. I had this call in my init():

Code: Select all

...
	CGameState::FadeInOut(pManager);
...
Once I commented this out from the init(), everything started working like the test demo project. I don't know why this interfered with the GUI environment behavior like a button being depressed/undepressed. Any idea, area51?

Geez, I just now realized a lot of what I tried actually worked but because I did not notice the FadeInOut call, I attributed the non-functional button to what I tried. Man, I'm a goof-ball! :roll:
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

I spent some time playing around with the GUI controls. I can't believe how in-flexible they are. For instance, I am unable to make a window title bar go away. Or am I able to tell a window that I create to not move when you hold down the left mouse button and drag the window. Also, one cannot skin the window you create. In addition, I was not able to attach a button to a window then move the window with the button moving with it. :(

But there's hope. I was able to add a tabcontrol which doesn't move! Yay! Basically, I added a tabcontrol GUI without any tabs then add button to it. After that, I would draw a 2d image (png with a transparent color) as a border -- sort of a like a poor man's skinning. :oops:
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Here's the code I used to make an options sub-window using a tab control GUI:

Code: Select all

		if (id == 102)
		{
			// create sub-tab control to act as a window since addWindow() is so limited --
			// cannot disable moving window, unable to attach buttons, etc.
			m_pCMSSelectAdventure = pManager->getGUIEnvironment()->addTabControl(
				rect<s32>(400,350,780,750),
				0,
				false,
				false,
				160);

			// add a button to represent adventure log 1 save game
			m_pCMSSelectAdventureLog01Button = pManager->getGUIEnvironment()->addButton(
				rect<s32>(45,5,345,55), 
				m_pCMSSelectAdventure, 
				261, 
				L"ADVENTURE LOG 1: Jcln");

			// add background image
			m_pCMSBackGround = pManager->getGUIEnvironment()->addImage(
				pManager->getDriver()->getTexture("media/single_adventure_window_border.png"),
				position2d<int>(400,350));

			// add element as child to parent so that it can be removed when parent is closed
			m_pCMSBackGround->addChild(m_pCMSSelectAdventure);
		}
For debugging purposes, when you click the button, it cleans up the window (this will be replaced with a screen to select the speed -- I'm currently working on one now):

Code: Select all


		// clean up when window is closed
		if (id == 261)
		{
			m_pCMSSelectAdventure->remove();
			m_pCMSBackGround->remove();

		}
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Crap! Another nasty bug has reared it's ugly head. I added the ability to right-click to close a sub-window in the options screen. Well, it works fine and dandy until you happen to right-click while the mouse cursor is over a button in one of the sub-window (base screen button is not affected)! It crashes the game with an unhandled exception error. Doh! :evil:

I'm currently stumped at how to fix this bug. So, I'll flesh out the other parts of the options screen then deal with this bug later. I just need to avoid right-clicking on a sub-option button. :D

I did managed to fix a minor bug today. When you enter the options screen, then exit and enter the credits screen -- the buttons from the options screen still shows.
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Well, I still haven't figured out how to fix the right-click-mouse-cursor-over-button issue (actually, I did not spend any time looking into a fix since the last post). I did managed to add in tons of menu code today.

We now have a "real" status window instead of the static image from before. I used the GUI static text label to display LV, HP, MP, G, E. Then I added the corresponding GUI static text label for the values of the aforementioned stats. These values will be updated according to game events (raise level, heal onself, gain experience, etc.).

We also now have a command window with buttons representing each of the available command options (talk, status, stairs, search, etc.). So far, I only have the status sub-window/dialog and the talk sub-window/dialog coded up. The menu code are no where near complete. It's just a bunch of code stitched together -- unoptimized/inefficient/so what buggy (i.e. very little testing has been done). :oops:

Man, I feel like I spent a week worth of work coding all this menu code/preparing/cleaning the graphics used for the border of the windows in two days. :cry:

But the end result is well worth the effort. :P
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

YES! YES! YES! I have squashed the nasty right-click unhandled exception bug! I introduced several bugs when I added support to control the menu display via the left/right mouse buttons -- click on left mouse button to open a window/click the right mouse button to close a window.

Well, when I go to close the window, I call (GUIElement* x) x->remove(). I made the mistake of calling remove() on the child GUI element even when the parent GUI window that it belongs to have long been removed. :D

The other problem was because I failed to set the correct state for one of the window that I'm currently in. This cause the previous window to be removed. But when you reach the previous window and try to remove it, it's already removed so you get an unhandled exception runtime error. :lol:

I feel so silly. But I also feel good that I figured out the bug on my own. :wink: Yet another hurtle overcometh! :P

Oh, I almost forgot. I added a "pause" option detailed elsewhere in the forum when accessing the command window options. Since the mouse moves where you look on the screen, it is not possible to select the command options on the command window. So, in the update(), I added the following code:

Code: Select all


...
	if (m_bPause == false)
	{
	pManager->getSceneManager()->drawAll();	
	}
...

Thanks to GFXstyLER from this thread:

http://irrlicht.sourceforge.net/phpBB2/ ... ause#56140

Unfortunately, everything goes blank except for the GUI elements. I was thinking maybe add in a static image. But ideally to be faithful to the original, the screen should not blank out -- but then again the original did not support a mouse (which is a pain to support by the way). The various game elements (mouse look disabled, NPC stop moving, etc.) should freeze in time. Oh, well. It will have to do for now. :(
Eternl Knight
Posts: 313
Joined: Tue Nov 01, 2005 5:01 am

Post by Eternl Knight »

I think that is something that needs to be "fixed" in Irrlicht. I'm thinking of adding a "stepScene" function to the device and refactoring the animators to work with it.

--EK
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Eternl Knight -- hmmm...interesting. Could you elaborate on "stepScene" function? Could you maybe post some psuedo code? Also, I'm not soo keen on what "refactoring" the animators mean. I know of this type of refactoring:

http://www.refactoring.com/

Is that along the line of what you're referring to when you mention "refactoring"? Thanks.
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Rats. I fixed the in-game command windows but somehow broke the option windows. What else is new? :shock:

Also, I need to erase the mouse cursor after-image whenever the game is paused.

Geez, you add one thing, 20 bugs/things you don't want pops up. :o
I guess that goes with the game development territory.

Hmmm...if irrlicht has a blog for it's developer, I am blogging my game development experience as I go in this thread it seems like. :oops:
Joe_Oliveri
Posts: 448
Joined: Tue Oct 05, 2004 3:24 am
Location: Boston, MA

Post by Joe_Oliveri »

Very nice, I think your idea and game is a very neat idea 3D yet classic 2D. It's really nice. Please follow through with this one. This could make a good indie game.
Irrlicht Moderator || Game Designer
Learn the basics at </dream.in.code>
Pazystamo
Posts: 115
Joined: Sat Dec 03, 2005 5:56 pm
Location: Lithuania
Contact:

Post by Pazystamo »

jclins wrote: Hmmm...if irrlicht has a blog for it's developer, I am blogging my game development experience as I go in this thread it seems like. :oops:
Try free http://www.blogger.com/start and post your link here :) It would be interesting to read some ideas :)
My project in forum- ATMOsphere - new dynamic sky dome for Irrlicht
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

SkaterX29527 -- Thank you for the kind words. Believe it or not, it motivates me a lot.

Pazystamo -- I actually started a blog a long time ago, but no one actually read it so I stopped. If I start again just for this project, it would consume too much of the time that could be spent on developing. So, when I become good enough (i.e. have created 3+ complete games), then I can try to multi-task. :)

Confused and dumbfounded, I have stepped into a pile of sequence soup complicated by the general abstract nature of Object Oriented computer programming. It is a deadly and vile tangled maze that eventually leads to a downward spiral to the abyss of confused programmers. This plane of existence is home to the once valiant, brave and bold programmers who can write 200 lines of code within a single blink of an eye. Their once amazing talent and prowess have succumbed to the dreaded plague of non-existence brought on by being split asundered by nasty bugs.
There, I have officially posted something that one would find on a blog. :lol:
jclins
Posts: 86
Joined: Thu Jan 01, 2004 10:29 pm
Location: Texas, USA

Post by jclins »

Hi all,

I've finally vanquished most of the more dangerous bugs in the menu/options system. So, I decided to post a video for all to see! :lol:

The video has been compressed to 2,757,932 bytes from 232,430,504 bytes :shock: :

http://rapidshare.de/files/12926981/Ing ... s.wmv.html

I still haven't figured out how to get rid of the ghost-crosshair when paused. So, you'll see it in the video when I bring up the command window.

Also, I haven't figured out how to left-justify text in a static text label or a button. So, you'll see must of the text centered. The ones that appear to be left justified where painfully oriented manually by me. :)

Although you may not notice it, all the menu/options are controlled by the mouse (left click to open/right click to close).

There are some buttons that just do nothing right now. I've just haven't got to it yet. :wink:

I'm currently evaluating the different script "engine" out there like irrLua. Anyone have a suggestion? I plan to use it for the conversation text and probably other stuff too. 8)
Post Reply