irrPreSetting

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Then I'm off to make the "pure" irrlicht version like how hybrid puts it.
Man, that would be so useful. Something like Ogre config launcher would be great.

In fact, if you make something like that I think it should go into the Irrlicht core code.
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Post by gfxstyler »

but please just when i can disable it :)

sorry i don't want to say your work is useless, but i dont like to have a similar dialog as ogre (i mean, beeing forced to use it)

see you!
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Okay, new version uploaded:

http://www.megaupload.com/?d=3BM2T98A

Here's a screen capture:

Image

Changes:

+ finally got xml reading/writing correct (thanks jam, hybrid, bitplane)
+ added ability for app to detect changes to gui elements and disable/enable the apply button as appropriate
+ added a basic status info to provide feedback to user (this is going to be enhanced into a log window in the future similar to irrEdit)
+ added logic to OK button (it's more or less the same code used for the apply button)
+ added logic to Cancel button (it just closes the app)

RapchikProgrammer -- thanks, but it's not that good. I only have basic error checking in right now. Hopefully, I have better error checking in future updates.

sio2 -- I've started work on the "pure" version already. :) I'm taking what I've learned with this version and apply it to the "pure" version.

gfxstyler -- well, that's why there's a "do not display again" button. It's currently disabled for this release. Once I get an example app going, I'll add logic to it and enable it. It's not very useful right now since if I say not to display it anymore, how do I test since my app is not going to run? :) Maybe that's a test in of itself. :shock:
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Okay, the pure version is well on it's way. It doesn't do anything useful yet. I'm just setting up the gui to make it look close as possible to the winform version:

Image

Image

Image

Ugly and drab might come to your mine when you look at the pics above. It's mainly for positioning the various gui elements in the gui window.

Once I get the gui the way I like it, then I'll add in the real meaty stuff like xml reading/writing, status feedback messages, button logic, etc.

Update:

Here's the current code:

Code: Select all


#include <irrlicht.h>

using namespace irr;
using namespace gui;

#pragma comment(lib, "Irrlicht.lib")

// init irrlicht device
IrrlichtDevice *device = 0;

// event receiver
class GUIEventReceiver : public IEventReceiver
{
public:
	virtual bool OnEvent(const SEvent & event)
	{
		return false;
	}
};

int main()
{
    // create GUI event receiver object
    GUIEventReceiver GUIreceiver;

    // instantiate a software irrlicht device
    device = createDevice(
        video::EDT_SOFTWARE, 
        core::dimension2d<s32>(640,480), 
        8,
        false, 
        false,
        false,
        &GUIreceiver);

    // create handle to 2D user interface
   	IGUIEnvironment* GUIenv = device->getGUIEnvironment();

    // create an empty gui window
	IGUIWindow* guiWindow = GUIenv->addWindow(
        core::rect<s32>(0,0,640,480),
		true, 
        L"irrPreSettings_Pure v1.0 build 061120", 
        0, 
        100);

    // add fullscreen check box
	IGUICheckBox* cbFullScreen = GUIenv->addCheckBox(
        false, 
        core::rect<s32>(10,35,100,45), 
        guiWindow, 
        101, 
        L"Fullscreen");

    // add stencil buffer check box
	IGUICheckBox* cbStencilBuffer = GUIenv->addCheckBox(
        false, 
        core::rect<s32>(105,35,195,45), 
        guiWindow, 
        102, 
        L"Stencilbuffer");

    // add vsync check box
	IGUICheckBox* cbVsync = GUIenv->addCheckBox(
        false, 
        core::rect<s32>(200,35,290,45), 
        guiWindow, 
        103, 
        L"Vsync");

    // add label for display driver combobox
    IGUIStaticText* lbDisplayDriver = GUIenv->addStaticText(
        L"Display Driver", 
        core::rect<s32>(10,65,90,80), 
        false, 
        false, 
        guiWindow,
        104,
        false);

    // add display driver combobox
    IGUIComboBox* cmbDisplayDriver = GUIenv->addComboBox(
        core::rect<s32>(100,65,250,80), 
        guiWindow, 
        105);

    // populate display driver combobox
    cmbDisplayDriver->addItem(L"Direct3D 9 Renderer");
    cmbDisplayDriver->addItem(L"Direct3D 8 Renderer");
    cmbDisplayDriver->addItem(L"OpenGL Renderer");
    cmbDisplayDriver->addItem(L"Software Renderer");
    cmbDisplayDriver->addItem(L"Apfelbaum Software Renderer");
    cmbDisplayDriver->addItem(L"Null Device");

    // add label for screen resolution combobox
    IGUIStaticText* lbScreenResolution = GUIenv->addStaticText(
        L"Screen Resolution", 
        core::rect<s32>(300,65,460,80), 
        false, 
        false, 
        guiWindow,
        106,
        false);

    // add screen resolution combobox
    IGUIComboBox* cmbScreenResolution = GUIenv->addComboBox(
        core::rect<s32>(390,65,550,80), 
        guiWindow, 
        107);

    // query the device to obtain the available video mode
    video::IVideoModeList * availableVideoModeList = device->getVideoModeList();

    // define array to hold a formatted listing of the availabe modes
    wchar_t formated_listing[64] = L" ";

    // go through all available video mode for graphic adapter
    for(int i = 0; i < availableVideoModeList->getVideoModeCount(); ++i)
    {
        // format available modes into desired listing
        swprintf(
            formated_listing,
            64,
            L"%i x %i pixels @ %i-bit colors",
            availableVideoModeList->getVideoModeResolution(i).Width,
            availableVideoModeList->getVideoModeResolution(i).Height,
            availableVideoModeList->getVideoModeDepth(i));

        // add formatted mode to combo list box
        cmbScreenResolution->addItem(formated_listing);
    }

    // add do not display again check box
	IGUICheckBox* cbDontDisplayAgain = GUIenv->addCheckBox(
        false, 
        core::rect<s32>(10,95,90,110), 
        guiWindow, 
        108, 
        L"Do not display again");

    // add label for status
    IGUIStaticText* lblStatus = GUIenv->addStaticText(
        L"status test", 
        core::rect<s32>(152,95,232,110), 
        false, 
        false, 
        guiWindow,
        109,
        false);

    // add okay button
	IGUIButton* bOK = GUIenv->addButton(
        core::rect<s32>(345,95,405,110), 
        guiWindow, 
        110, 
        L"OK");

    // add apply button
	IGUIButton* bApply = GUIenv->addButton(
        core::rect<s32>(410,95,470,110), 
        guiWindow, 
        111, 
        L"Apply");

    // add cancel button
	IGUIButton* bCancel = GUIenv->addButton(
        core::rect<s32>(475,95,535,110), 
        guiWindow, 
        112, 
        L"Cancel");

    // don't let user resize the window
	device->setResizeAble(false);

    // display app title and version information
	device->setWindowCaption(L"irrPreSettings_Pure v1.0 build 061120");

    // obtain handle to video driver
	video::IVideoDriver* vidDriver = device->getVideoDriver();

    // obtain handle to scene manager
	scene::ISceneManager* sceneManager = device->getSceneManager();

    // add camera scene node
	sceneManager->addCameraSceneNodeMaya();

    // runs until device wants to be deleted and
    // video driver is valid
    while(device->run() && vidDriver)
    {
        // draw stuff only when the app window is active
        if(device->isWindowActive())
        {
            // setup the scene for rendering
            vidDriver->beginScene(
                true, 
                false,
                video::SColor(150,50,50,50));

            // draws all the scene nodes
            sceneManager->drawAll();

            // draws all gui elements
            GUIenv->drawAll();

            // shows the rendered scene on screen
            vidDriver->endScene();
        }
    }

    // cleanup
	device->drop();

    // exit
    return 0;
}

There's a lot of code but not a lot to look at visually. I'm going to play around with the font and background colors to see if I can make it look less ugly. :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Very nice 8)
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Doh! Alpha transparency is on by default. I also changed out the builtin font with a bitmap font. Which causes the gui element to look funny. So, after some repositioning/resizing, here's another side-by-side view:

Image

hybrid -- thanks! I'm thinking of changing from gui window to gui tab control (but without the tabs) since I can't figure out how to stop the user from dragging the inner window around. :(

Anyway, I've been playing around with the gui skin but haven't had much luck. I think I'm going to leave the gui alone for now and start adding in the logic to do xml read/write, button presses, etc. The fun stuff. :)
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Note to self: whenever you have two vs2005 IDEs opened, the debugger cannot be trusted. :twisted:

I did a lot of head scratching to see why the xml reader code was giving me EXN_UNKNOWN as the return value from getNodeType(). I looked at the "FF FE" that is in the xml file. I switched out a different xml file that doesn't have the "FF FE." I jumped around my code putting break points here and there. Still, no answers.

I left for a while and came back. Then a thought crossed my mine. I have two vs2005 running. That couldn't be the problem could it? MS is smarter than that, right? As soon as I closed the second vs2005 instance. Everything worked. :roll:

Anyway, I've managed to add in code to read the xml file in and parse the xml tags. It took some work to redo some of the .net specific calls. Then I had to adjust to irrlicht's way of making gui calls instead of .net winform way. Also, I had to throw out some stuff from the .net winform code that just doesn't make sense under win32 console. But all in all, things seem to be working.

I did away with the window gui element and used a tab control element. I ran into a small issue with the tab control element. If you don't add a tab to it, it leaves a blank bar across the top of the tab control. I had to offset the on the y to move it offscreen to hide the blank bar. Then I had to offset all of the gui controls by a little bit down to make up for moving the tab control off screen. :oops:

I also couldn't find a gui that replaces a messagebox call in the winform version. So, I had to roll my own messagebox. Basically, using the window gui element for error message popups. So, my window gui code didn't have to go to waster after all. :)

At any rate, here's the pure version with the tab control instead of the window gui (which shows another window within a window when the app is running in a window):

Image

Visually, it's starting to look like a window, no? :D

Now, I just need to figure out what to do with all the empty spaces. Maybe I'll stick a giant picture of the irrlicht logo there or something.

Update:

Nevermind. Irrlicht does have a message box gui. How I missed it is beyond me. I think it's time for bed. :?
Saturn
Posts: 418
Joined: Mon Sep 25, 2006 5:58 pm

Post by Saturn »

gfxstyler wrote:sorry i don't want to say your work is useless, but i dont like to have a similar dialog as ogre (i mean, beeing forced to use it)
You aren't forced in Ogre to use the dialog, it is completely optional.
lug
Posts: 79
Joined: Tue May 02, 2006 5:15 am
Contact:

Post by lug »

Finally, a working build of the pure version. Well, functionally equal to the winform version.

All the button logic have been coded, the apply button will gray out/disable once you make a change and enable when it detects a change occur in a gui element, irrlicht messagebox is used for error prompts (can't seem to set the body text though after creation), reads in xml file, and writes to xml file.

There are some things to keep in mine with this version. I can't seem to gray out/disable the checkbox gui element for "don't display again" using setEnabled() (it works for buttons but not checkboxes). So, you can check it and uncheck it all day but it won't do anything yet.

As mentioned before, the body of the error prompts doesn't have any text in it. When you click in the lower part of the window, the screen flashes for some reason. I'm guessing this has to do with me offsetting the tab control window or something. I also don't like the extra dos window that pops up. I think that's all.

The code is in very convoluted at this point. So, I'll wait until it's all pretty up before posting it. It's mainly because I couldn't get the string/wchar_t/chr conversion to work like it did in the winform version. So, I had to scrap the old code and add in a bunch of new code to handle these conversions.

It hasn't changed much visually, so no screen shot this time around. The majority of changes were under the hood.

Download from here:

http://www.megaupload.com/?d=H0DJ86FG

Update:

I just noticed that the app eats up a ton of cpu time while running. I'm going to add to wait state to minimize the cpu consumption. :oops:

Update 2:

I added a sleep call but it made the gui less responsive so I removed it. :)

Anyway, I've made two new builds for people who uses windows x64 (vista or xp):

irrPreSettings x64 (64-bit) .NET 2.0 windows forms version:

http://www.megaupload.com/?d=BP18M35Z

irrPreSettings_Pure x64 (64-bit) windows console version:

http://www.megaupload.com/?d=KIM27TZD

Nothing new other than a re-compile targeting 64-bit windows.

Update 3:

Because we don't have enough versions yet of irrPreSettings. :lol:

lug, presents two more versions for you guys to try out. Both of these versions do not show the dos window when run. That's because they use the win32 api so it's a win32 app instead of a win32 console app.

irrPreSettings_Pure_Win32 windows version:

http://www.megaupload.com/?d=NEYKPBOM

irrPreSettings_Pure_x64 (64-bit) windows version:

http://www.megaupload.com/?d=RI7C721H

:wink:

Update 4:

I've been testing out applying custom skinning both the pure and the non-pure version. Here's a list of features coming for v1.1 (all of these will be stored in a separate "config.xml" file that way the "presetting.xml" file will be kept uncluttered; plus if you don't want to customize the gui, then you don't need to include the "config.xml" file):

- change font
- change font size
- change transparency
- change background color
- change window skin
- add music
- add sound (for button clicks)
- enable transitional fade in/out

Anyway, let me know what you guys think. If you have any additional suggestion, please post.

I'll try to make the "config.xml" file tags similar between the non-pure and pure versions of irrPreSettings. But both uses an entirely different gui system so no guarantees. :)

Update 5:

Wow, this is turning out to be a music player too! While adding in the above features, I thought to myself. Hmm...why not allow the user to stop and start the music or enable or disable the sound while in the gui? Why not? I'm not sure how to show it yet. Maybe it's going to be hidden by default and only shown like an advanced option or something? Since a lot of these new features aren't related to setting the presettings. Anyway, I'm still thinking about it.

Update 6:

Adding support for freetype v2.2.1 found while searching through irrlicht forum:

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3995

:shock: amazing what one finds in this forum...

Update 7:

I've re-organized and cleaned the codebase into a class and changed all types to irrlicht types (where possible). I've also ran a memory leak test and found none. :D

Here's what main.cpp looks like now:

Code: Select all


// memory leak detection
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
// memory leak detection

#include "CIrrPreSettings.h"

// disable declared deprecated warnings for "wcscpy" and "_snwprintf"
#pragma warning( disable : 4996 )

// hides the console window
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")

int main()
{
    // memory leak detection
    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
    // memory leak detection

    // create application
    irrpresettings::CIrrPreSettings app;

    // run application
    app.run();

    // exit
    return 0;
}
paddy
Posts: 25
Joined: Tue Oct 23, 2007 12:30 pm

Post by paddy »

very useful tool, I would like to use it but the last download links are broken, could you plz fix ?

many thx!
paddy
Posts: 25
Joined: Tue Oct 23, 2007 12:30 pm

Post by paddy »

nobody has it anymore ??? :-(
tewe76
Posts: 42
Joined: Wed Jan 21, 2009 10:56 am
Location: Spain
Contact:

Post by tewe76 »

I'd like that too. Any body has a link to it?
Post Reply