Irrlicht & wxWidgets

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
ceyron
Posts: 63
Joined: Tue Mar 03, 2009 5:10 pm
Location: Bucuresti, România

Post by ceyron »

EDIT: Wait a minute... Did you upgrade the Irrlicht SDK to 1.6?
Yes i have version 1.6 of irrlicht.

Phew...I finally managed to compile your code on linux, but unfortunately it doesn't run as it should, it looks like below, also there are error messages in the terminal :?

I didn't modify your code that much just got rid of the HWND and replaced it with WXWidget; also i deleted the code with HCURSOR(i think HCURSOR is windows only).Looking at the terminal errors maybe i am passing the wrong handle to param.WindowId ??.

Code: Select all

/* 
    #######################
    modified in wxIrrlicht.h
    #######################
*/

typedef WXWidget     HWND;

Image


Also to test if there are any problems with my wx libraries or irrlicht i made this simple(but poorly designed :lol: ) test app and it both compiles and runs just fine on my machine.

Code: Select all

#include <wx/wxprec.h>
#include <wx/wx.h>
#include <irrlicht.h>
#include <stdlib.h>

using namespace irr;

class HelloWorldApp : public wxApp
{
public:
	virtual bool OnInit();
};

IMPLEMENT_APP(HelloWorldApp)

// This is executed upon startup, like 'main()' in non-wxWidgets programs.
bool HelloWorldApp::OnInit()
{
	wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
        frame->SetDoubleBuffered(true);
	frame->Show(true);
	SetTopWindow(frame);


        IrrlichtDevice* device = irr::createDevice(video::EDT_OPENGL,core::dimension2d<u32>(800,600),32);

        if(!device)
            Exit();

        scene::ISceneManager* smgr = device->getSceneManager();
        video::IVideoDriver* driver = device->getVideoDriver();
        gui::IGUIEnvironment* guienv = device->getGUIEnvironment();

        smgr->addCameraSceneNodeMaya();

        scene::ILightSceneNode* light=smgr->addLightSceneNode(0,core::vector3df(130,120,1));
        light->setLightType(video::ELT_POINT);
        
        for(int i=1; i<500; ++i)
        {
            srand(i);

            f32 t = static_cast<f32>(rand() % i + 1);
            smgr->addCubeSceneNode(20,0,-1,core::vector3df(t,i,t+i))->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
        }


        gui::IGUIEditBox* txt = guienv->addEditBox(L"",core::rect<s32>(5,5,400,25));

        int lastFPS = -1;

        while(device->run())
        {
            driver->beginScene(true,true, video::SColor(255,100,101,140), frame->GetHandle());

                smgr->drawAll();
                guienv->drawAll();

            driver->endScene();

            int fps = driver->getFPS();

            if (lastFPS != fps)
            {
                    core::stringw str = L"FPS: ";
                    str += fps;
                    str += L"   Drawn: " ;
                    str += driver->getPrimitiveCountDrawn();

                    txt->setText(str.c_str());
                    lastFPS = fps;
            }

        }

        device->drop();

        frame->Destroy();
        Exit();
        
	return true;
}
Image
george++
Posts: 16
Joined: Mon Sep 28, 2009 5:30 pm
Location: Hellas

Post by george++ »

As I mentioned before I am not linux guy but I think the problem is what you have already mentioned:
Probably you are passing a wrong handle of param.WindowId
Here is a quotation from the wxWidgets manual for the GetHandle() method of the wxWindow class:
Returns the platform-specific handle of the physical window. Cast it to an appropriate handle, such as HWND for Windows, Widget for Motif, GtkWidget for GTK or WinHandle for PalmOS
I suppose you have to cast the appropriate handle for your linux version (?)
May the software be with you
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Thanks George.

I was able to compile your example.

Compiled the wxWidget 2.8.1 to "Release Unicode", put the proper paths for the includes and library and was able to compile and run it. I will have to recompile wxWidget again, because I don't want to use the MSVC DLL. But now it's looking great. Seem to support everything Irrlicht can support (video drivers). Tried OpenGL and worked like a charm.
Last edited by christianclavet on Wed Oct 19, 2011 3:15 pm, edited 1 time in total.
stevebondy
Posts: 20
Joined: Thu Aug 13, 2009 5:47 pm
Location: British Columbia, Canada

Post by stevebondy »

George,

I'd be happy to host these on my website if you like. I just finished making an "irrlicht with wxwidgets" template for myself, and then I found yours which is much better.

If you want me to host them, send me a PM with whatever information and links you'd like me to include.

Steve
george++ wrote:Here is the link:
http://www.moraldigames.com/Temp/IrrlichtTutorials.zip
any idea how to get rid of the menu flickering when it drops down?
Nop.

Please take into account that this link will be no available for a long period. If someone wants to host these files then I will be grateful if there is a reference to me and my site.
Thanks.
stevebondy
Posts: 20
Joined: Thu Aug 13, 2009 5:47 pm
Location: British Columbia, Canada

Building with codeblocks and mingw

Post by stevebondy »

Has anyone successfully built this with Code::Blocks and mingw (gcc)?

I have gotten it to compile and link successfully, but the program simply crashes when I try to run it.

Below is the codeblocks project file. If anyone else has done this or cares to try I'd appreciate the help.

Thanks,

Steve

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="wxIrrHello" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="wxIrrHello" prefix_auto="1" extension_auto="1" />
				<Option object_output="objs\Debug\" />
				<Option type="0" />
				<Option compiler="gcc" />
				<Option projectLinkerOptionsRelation="2" />
				<Compiler>
					<Add option="-g" />
					<Add directory="$(#wx)\lib\gcc_dll\mswu" />
					<Add directory="$(#irrlicht.include)" />
				</Compiler>
				<ResourceCompiler>
					<Add directory="$(#wx)\lib\gcc_dll\mswu" />
				</ResourceCompiler>
				<Linker>
					<Add library="libwxmsw28u.a" />
					<Add library="irrlicht" />
					<Add directory="$(#wx)\lib\gcc_dll" />
					<Add directory="$(#irrlicht.lib)\Win32-gcc" />
				</Linker>
			</Target>
			<Target title="Release">
				<Option output="wxIrrHello" prefix_auto="1" extension_auto="1" />
				<Option object_output="objs\" />
				<Option type="0" />
				<Option compiler="gcc" />
				<Option projectLinkerOptionsRelation="2" />
				<Compiler>
					<Add option="-O2" />
					<Add directory="$(#wx)\lib\gcc_dll\mswu" />
				</Compiler>
				<ResourceCompiler>
					<Add directory="$(#wx)\lib\gcc_dll\mswu" />
				</ResourceCompiler>
				<Linker>
					<Add option="-s" />
					<Add library="libwxmsw28u.a" />
					<Add directory="$(#wx)\lib\gcc_dll" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-pipe" />
			<Add option="-mthreads" />
			<Add option="-D__GNUWIN32__" />
			<Add option="-D__WXMSW__" />
			<Add option="-DWXUSINGDLL" />
			<Add option="-DwxUSE_UNICODE" />
			<Add option='[[if (PLATFORM == PLATFORM_MSW && (GetCompilerFactory().GetCompilerVersionString(_T("gcc")) >= _T("4.0.0"))) print(_T("-Wno-attributes"));]]' />
			<Add option="-Wall" />
			<Add directory="$(#wx)\include" />
			<Add directory="$(#wx)\contrib\include" />
		</Compiler>
		<ResourceCompiler>
			<Add directory="$(#wx)\include" />
		</ResourceCompiler>
		<Unit filename="resource.rc">
			<Option compilerVar="WINDRES" />
		</Unit>
		<Unit filename="wxIViewport.cpp" />
		<Unit filename="wxIViewport.h" />
		<Unit filename="wxIWindow.cpp" />
		<Unit filename="wxIWindow.h" />
		<Unit filename="wxIrrHelloApp.cpp" />
		<Unit filename="wxIrrHelloApp.h" />
		<Unit filename="wxIrrHelloMain.h" />
		<Unit filename="wxsmith\wxIrrHelloframe.wxs" />
		<Extensions>
			<code_completion />
			<debugger />
			<wxsmith version="1">
				<gui name="wxWidgets" src="wxIrrHelloApp.cpp" main="wxIrrHelloFrame" init_handlers="necessary" language="CPP" />
				<resources>
					<wxFrame wxs="wxsmith/wxIrrHelloframe.wxs" src="wxIrrHelloMain.cpp" hdr="wxIrrHelloMain.h" name="wxIrrHelloFrame" language="CPP" />
				</resources>
			</wxsmith>
		</Extensions>
	</Project>
</CodeBlocks_project_file>
[/code]
xray
Posts: 231
Joined: Fri Feb 02, 2007 1:06 pm
Location: Germany, Munich
Contact:

Post by xray »

Well here it works with my code::blocks, but I implemented this into my project, because I had the same problem you had. So maybe some code lines in the wxframe constructor make some problems ? I used the actual svn + direct3d.
stevebondy
Posts: 20
Joined: Thu Aug 13, 2009 5:47 pm
Location: British Columbia, Canada

Got it done

Post by stevebondy »

I finally got this working with code::blocks, mingw and MS Windows. Had to make a few changes here and there, but now its done and it looks great.

I've hosted a copy on my website as per George's request. There are two versions available - the source only, and source with a pre-built executable and the required DLL's.

http://stevebondy.ca/Downloads.html
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Post by netpipe »

steve that link is non functional since you posted it. also does this work on linux now too ?
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

ha

Post by netpipe »

http://www.xup.in/dl,96837020/AgEditor-wx.7z/ << a little progress, but it eeds help
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Irrlicht & wxWidgets

Post by netpipe »

http://www.xup.in/dl,74920010/wxIrrHello.7z/

most basic working version possible.... sweet
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Irrlicht & wxWidgets

Post by christianclavet »

Steve, Avast bloqued the access to your page mentionning that it was infected (IFrame-inf). You should remove your IFrame in your download page as antivirus software will block everybody to access it.

Here is an video explanation about the IFrame: http://www.youtube.com/watch?v=jgdCoo27 ... re=related
Edit: You should check your main website, your "web template" is not there anymore, your site look completely broken!
Post Reply