Irrlicht with wxWidget, no win32
Irrlicht with wxWidget, no win32
Exist a tutorial example show how to use irrlicht with win32 application, there are a tutorial or an exemple with wxwidget?
Thank you.
Selles
Thank you.
Selles
there is not, but i asked some time ago if irrlicht can be used with wxwidgets and the answer was: if wxwidgets provides a hwnd (window handle) then it should be possible.
you could try it out by using the irrlicht tutorial for win32 and try it the same way with wxwidgets.
maybe that helps you a bit
you could try it out by using the irrlicht tutorial for win32 and try it the same way with wxwidgets.
maybe that helps you a bit
I don't have an actual C++ example to show you, but it does work.
Code: Select all
//psuedo code
wxDialog *Dlg = new wxDialog(-1, "Test", wxPoint(0,0), wxSize(400,400));
SIrrlichtCreationParameters params;
params.WindowId = Dlg->GetHandle();
params.DriverType = EDT_OPENGL;
params.WindowSize = dimension2d(200,200);
device = createDeviceEx(¶ms);
while(device->run())
{
Dlg->Refresh(); // <- bad ;) It would be better to actually implement
// a real messge loop, but this little trick does work
driver->beginScene();
smgr->drawAll();
driver->EndScene();
}
the problem is that the event associated to the object "param"
..doesn't work when the object that gave the handle has a parent and when the object doesn't have a parent he sees an independent frame and appears titlebar
I didn't get to do the window of the irrlicht inside of a frame without it occupies the whole window and with the event working. .
does anybody know it what it happens?
please help me.
Thank you.
Code: Select all
param.EventReceiver=&evento;
I didn't get to do the window of the irrlicht inside of a frame without it occupies the whole window and with the event working. .
does anybody know it what it happens?
please help me.
Thank you.
look in 3rd reply in this topic, there are some errors ..
params.WindowId = Dlg->GetHandle(); //<-don´t work
params.WindowId =wx_reinterpret_cast(s32, Dlg->GetHandle()); //<-work
params.WindowSize = dimension2d(200,200); //<-don't work
params.WindowSize = dimension2d<s32>(200,200); //<-work
so, that work well, I think..
but don't wait to use events because I think that nobody get it..
params.WindowId = Dlg->GetHandle(); //<-don´t work
params.WindowId =wx_reinterpret_cast(s32, Dlg->GetHandle()); //<-work
params.WindowSize = dimension2d(200,200); //<-don't work
params.WindowSize = dimension2d<s32>(200,200); //<-work
so, that work well, I think..
but don't wait to use events because I think that nobody get it..
param.WindowId
1. Does "params.WindowId" above require a int WINAPI WinMain method?zenaku wrote:I don't have an actual C++ example to show you, but it does work.
Code: Select all
//psuedo code wxDialog *Dlg = new wxDialog(-1, "Test", wxPoint(0,0), wxSize(400,400)); SIrrlichtCreationParameters params; params.WindowId = Dlg->GetHandle(); params.DriverType = EDT_OPENGL; params.WindowSize = dimension2d(200,200); device = createDeviceEx(¶ms); while(device->run()) { Dlg->Refresh(); // <- bad ;) It would be better to actually implement // a real messge loop, but this little trick does work driver->beginScene(); smgr->drawAll(); driver->EndScene(); }
2. Also, in Nico's win32 Irrlicht tutorial, the usage seems to be "param.WindowId" (not params). What is the difference in usage here?
Many thanks for any helpful hints.
Can anyone provide the real C++ code to integrate Irrlicht into wxWidgets? I want to create a map editor.
Thanks.
Thanks.
Open Source all the way, baby
OSRPG
OSRPG
Here you go ...
This is a minimalistic app based on the win32 sample. This has been tested on MS VisualStudio.Net 2003. If you find any mistake in it do let me know.
Thanks
Mobeen
Thanks
Mobeen
Code: Select all
///////////////////////////////////////////////////////
//MyHeader.h //////////////////////////////////////////
///////////////////////////////////////////////////////
#ifndef MY_HEADER
#define MY_HEADER
#include <wx/wx.h>
#include <irrlicht.h>
using namespace irr;
using namespace irr::scene;
using namespace irr::video;
//linker input file
#pragma comment(lib, "irrlicht.lib")
//Menu id
#define ID_EXIT 1001
class MyApp: public wxApp
{
public:
bool OnInit();
};
class MyFrame: public wxFrame
{
protected:
IrrlichtDevice* device;
ISceneManager* smgr;
IVideoDriver* driver;
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
~MyFrame();
void OnExit(wxCommandEvent& event);
virtual void OnIdle(wxIdleEvent& event);
DECLARE_EVENT_TABLE()
};
#endif
///////////////////////////////////////////////////////
//End of MyHeader.h ///////////////////////////////////
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
//Main.cpp ///////////////////////////////////////////
///////////////////////////////////////////////////////
#include "MyHeader.h"
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_EXIT,OnExit)
EVT_IDLE(OnIdle)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World in wxWidgets", wxPoint(50,50), wxSize(450,340));
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
void MyFrame::OnIdle(wxIdleEvent& event)
{
if(device->run())
{
int W=0;
int H=0;
GetClientSize(&W,&H);
driver->setViewPort(irr::core::rect<s32>(0,0,W,H));
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
}
Refresh(false);
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_EXIT, "E&xit" );
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" );
SetMenuBar( menuBar );
//Irrlicht stuff
irr::SIrrlichtCreationParameters param;
param.WindowSize = irr::core::dimension2d<s32>(size.x,size.y);
param.WindowId = reinterpret_cast<s32>((HWND)GetHandle()); // hColorButton
param.DriverType = video::EDT_DIRECT3D9;
device = irr::createDeviceEx(param);
// setup a simple 3d scene
smgr = device->getSceneManager();
driver = device->getVideoDriver();
scene::ICameraSceneNode* cam = smgr->addCameraSceneNode();
cam->setTarget(core::vector3df(0,0,0));
scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(core::vector3df(0,10,0), 30.0f);
cam->addAnimator(anim);
anim->drop();
scene::ISceneNode* cube = smgr->addCubeSceneNode(20);
cube->setMaterialTexture(0, driver->getTexture("media/rockwall.bmp"));
cube->setMaterialFlag( video::EMF_LIGHTING, false );
smgr->addSkyBoxSceneNode(
driver->getTexture("media/irrlicht2_up.jpg"),
driver->getTexture("media/irrlicht2_dn.jpg"),
driver->getTexture("media/irrlicht2_lf.jpg"),
driver->getTexture("media/irrlicht2_rt.jpg"),
driver->getTexture("media/irrlicht2_ft.jpg"),
driver->getTexture("media/irrlicht2_bk.jpg"));
}
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
MyFrame::~MyFrame()
{
device->drop();
}
///////////////////////////////////////////////////////
//End of Main.cpp /////////////////////////////////////
///////////////////////////////////////////////////////
Proud to be a PAKISTANI
does this create a seperate window?
hello
Does this code create a seperate window? or its embedded directly in irrlicht like the other gui s ?
Does this code create a seperate window? or its embedded directly in irrlicht like the other gui s ?
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt