Commit 524cbc4a authored by hybrid's avatar hybrid

Added a checkbox for enabling antialiasing.

Changed to use createDeviceEx for all creation parameters.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1714 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 540c3396
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
#include "CDemo.h" #include "CDemo.h"
CDemo::CDemo(bool f, bool m, bool s, bool a, bool v, video::E_DRIVER_TYPE d) CDemo::CDemo(bool f, bool m, bool s, bool a, bool v, bool fsaa, video::E_DRIVER_TYPE d)
: fullscreen(f), music(m), shadows(s), additive(a), vsync(v), : fullscreen(f), music(m), shadows(s), additive(a), vsync(v), aa(fsaa),
driverType(d), device(0), driverType(d), device(0),
#ifdef USE_IRRKLANG #ifdef USE_IRRKLANG
irrKlang(0), ballSound(0), impactSound(0), irrKlang(0), ballSound(0), impactSound(0),
...@@ -45,7 +45,17 @@ void CDemo::run() ...@@ -45,7 +45,17 @@ void CDemo::run()
resolution.Height = 480; resolution.Height = 480;
} }
device = createDevice(driverType, resolution, 32, fullscreen, shadows, vsync, this); irr::SIrrlichtCreationParameters params;
params.DriverType=driverType;
params.WindowSize=resolution;
params.Bits=32;
params.Fullscreen=fullscreen;
params.Stencilbuffer=shadows;
params.Vsync=vsync;
params.AntiAlias=aa;
params.EventReceiver=this;
device = createDeviceEx(params);
if (!device) if (!device)
return; return;
...@@ -161,6 +171,7 @@ bool CDemo::OnEvent(const SEvent& event) ...@@ -161,6 +171,7 @@ bool CDemo::OnEvent(const SEvent& event)
device->getVideoDriver()->writeImageToFile(image, "screenshot.tga"); device->getVideoDriver()->writeImageToFile(image, "screenshot.tga");
device->getVideoDriver()->writeImageToFile(image, "screenshot.ppm"); device->getVideoDriver()->writeImageToFile(image, "screenshot.ppm");
device->getVideoDriver()->writeImageToFile(image, "screenshot.jpg"); device->getVideoDriver()->writeImageToFile(image, "screenshot.jpg");
device->getVideoDriver()->writeImageToFile(image, "screenshot.pcx");
image->drop(); image->drop();
} }
} }
......
...@@ -36,7 +36,7 @@ class CDemo : public IEventReceiver ...@@ -36,7 +36,7 @@ class CDemo : public IEventReceiver
{ {
public: public:
CDemo(bool fullscreen, bool music, bool shadows, bool additive, bool vsync, video::E_DRIVER_TYPE driver); CDemo(bool fullscreen, bool music, bool shadows, bool additive, bool vsync, bool aa, video::E_DRIVER_TYPE driver);
~CDemo(); ~CDemo();
...@@ -57,6 +57,7 @@ private: ...@@ -57,6 +57,7 @@ private:
bool shadows; bool shadows;
bool additive; bool additive;
bool vsync; bool vsync;
bool aa;
video::E_DRIVER_TYPE driverType; video::E_DRIVER_TYPE driverType;
IrrlichtDevice *device; IrrlichtDevice *device;
......
...@@ -65,13 +65,14 @@ private: ...@@ -65,13 +65,14 @@ private:
CMainMenu::CMainMenu() CMainMenu::CMainMenu()
: startButton(0), MenuDevice(0), selected(2), start(false), fullscreen(true), : startButton(0), MenuDevice(0), selected(2), start(false), fullscreen(true),
music(true), shadows(false), additive(false), transparent(true), vsync(false) music(true), shadows(false), additive(false), transparent(true), vsync(false), aa(false)
{ {
} }
bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
bool& outAdditive, bool &outVSync, video::E_DRIVER_TYPE& outDriver) bool& outAdditive, bool& outVSync, bool& outAA,
video::E_DRIVER_TYPE& outDriver)
{ {
MenuDevice = createDevice(video::EDT_BURNINGSVIDEO, MenuDevice = createDevice(video::EDT_BURNINGSVIDEO,
core::dimension2d<s32>(512, 384), 16, false, false, false, this); core::dimension2d<s32>(512, 384), 16, false, false, false, this);
...@@ -129,14 +130,16 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, ...@@ -129,14 +130,16 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
guienv->addCheckBox(fullscreen, core::rect<int>(20,85+d,130,110+d), guienv->addCheckBox(fullscreen, core::rect<int>(20,85+d,130,110+d),
optTab, 3, L"Fullscreen"); optTab, 3, L"Fullscreen");
guienv->addCheckBox(music, core::rect<int>(20,110+d,130,135+d), guienv->addCheckBox(music, core::rect<int>(135,85+d,245,110+d),
optTab, 4, L"Music & Sfx"); optTab, 4, L"Music & Sfx");
guienv->addCheckBox(shadows, core::rect<int>(20,135+d,230,160+d), guienv->addCheckBox(shadows, core::rect<int>(20,110+d,135,135+d),
optTab, 5, L"Realtime shadows"); optTab, 5, L"Realtime shadows");
guienv->addCheckBox(additive, core::rect<int>(20,160+d,230,185+d), guienv->addCheckBox(additive, core::rect<int>(20,135+d,230,160+d),
optTab, 6, L"Old HW compatible blending"); optTab, 6, L"Old HW compatible blending");
guienv->addCheckBox(vsync, core::rect<int>(20,185+d,230,210+d), guienv->addCheckBox(vsync, core::rect<int>(20,160+d,230,185+d),
optTab, 7, L"Vertical synchronisation"); optTab, 7, L"Vertical synchronisation");
guienv->addCheckBox(aa, core::rect<int>(20,185+d,230,210+d),
optTab, 8, L"Antialiasing");
// add about text // add about text
...@@ -286,6 +289,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, ...@@ -286,6 +289,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
outShadows = shadows; outShadows = shadows;
outAdditive = additive; outAdditive = additive;
outVSync = vsync; outVSync = vsync;
outAA = aa;
switch(selected) switch(selected)
{ {
...@@ -376,6 +380,10 @@ bool CMainMenu::OnEvent(const SEvent& event) ...@@ -376,6 +380,10 @@ bool CMainMenu::OnEvent(const SEvent& event)
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
vsync = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); vsync = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
break; break;
case 8:
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
aa = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
break;
} }
} }
......
...@@ -15,7 +15,8 @@ public: ...@@ -15,7 +15,8 @@ public:
CMainMenu(); CMainMenu();
bool run(bool& outFullscreen, bool& outMusic, bool& outShadows, bool run(bool& outFullscreen, bool& outMusic, bool& outShadows,
bool& outAdditive, bool &outVSync, video::E_DRIVER_TYPE& outDriver); bool& outAdditive, bool &outVSync, bool& outAA,
video::E_DRIVER_TYPE& outDriver);
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
...@@ -33,6 +34,7 @@ private: ...@@ -33,6 +34,7 @@ private:
bool additive; bool additive;
bool transparent; bool transparent;
bool vsync; bool vsync;
bool aa;
scene::IAnimatedMesh* quakeLevel; scene::IAnimatedMesh* quakeLevel;
scene::ISceneNode* lightMapNode; scene::ISceneNode* lightMapNode;
......
...@@ -26,6 +26,7 @@ int main(int argc, char* argv[]) ...@@ -26,6 +26,7 @@ int main(int argc, char* argv[])
bool shadows = false; bool shadows = false;
bool additive = false; bool additive = false;
bool vsync = false; bool vsync = false;
bool aa = false;
#ifndef _IRR_WINDOWS_ #ifndef _IRR_WINDOWS_
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL; video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
...@@ -36,10 +37,10 @@ int main(int argc, char* argv[]) ...@@ -36,10 +37,10 @@ int main(int argc, char* argv[])
CMainMenu menu; CMainMenu menu;
//#ifndef _DEBUG //#ifndef _DEBUG
if (menu.run(fullscreen, music, shadows, additive, vsync, driverType)) if (menu.run(fullscreen, music, shadows, additive, vsync, aa, driverType))
//#endif //#endif
{ {
CDemo demo(fullscreen, music, shadows, additive, vsync, driverType); CDemo demo(fullscreen, music, shadows, additive, vsync, aa, driverType);
demo.run(); demo.run();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment