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 @@
#include "CDemo.h"
CDemo::CDemo(bool f, bool m, bool s, bool a, bool v, video::E_DRIVER_TYPE d)
: fullscreen(f), music(m), shadows(s), additive(a), vsync(v),
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), aa(fsaa),
driverType(d), device(0),
#ifdef USE_IRRKLANG
irrKlang(0), ballSound(0), impactSound(0),
......@@ -45,7 +45,17 @@ void CDemo::run()
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)
return;
......@@ -161,6 +171,7 @@ bool CDemo::OnEvent(const SEvent& event)
device->getVideoDriver()->writeImageToFile(image, "screenshot.tga");
device->getVideoDriver()->writeImageToFile(image, "screenshot.ppm");
device->getVideoDriver()->writeImageToFile(image, "screenshot.jpg");
device->getVideoDriver()->writeImageToFile(image, "screenshot.pcx");
image->drop();
}
}
......
......@@ -36,7 +36,7 @@ class CDemo : public IEventReceiver
{
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();
......@@ -57,6 +57,7 @@ private:
bool shadows;
bool additive;
bool vsync;
bool aa;
video::E_DRIVER_TYPE driverType;
IrrlichtDevice *device;
......
......@@ -65,13 +65,14 @@ private:
CMainMenu::CMainMenu()
: 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& outAdditive, bool &outVSync, video::E_DRIVER_TYPE& outDriver)
bool& outAdditive, bool& outVSync, bool& outAA,
video::E_DRIVER_TYPE& outDriver)
{
MenuDevice = createDevice(video::EDT_BURNINGSVIDEO,
core::dimension2d<s32>(512, 384), 16, false, false, false, this);
......@@ -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),
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");
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");
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");
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");
guienv->addCheckBox(aa, core::rect<int>(20,185+d,230,210+d),
optTab, 8, L"Antialiasing");
// add about text
......@@ -286,6 +289,7 @@ bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows,
outShadows = shadows;
outAdditive = additive;
outVSync = vsync;
outAA = aa;
switch(selected)
{
......@@ -376,6 +380,10 @@ bool CMainMenu::OnEvent(const SEvent& event)
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
vsync = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
break;
case 8:
if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED )
aa = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
break;
}
}
......
......@@ -15,7 +15,8 @@ public:
CMainMenu();
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);
......@@ -33,6 +34,7 @@ private:
bool additive;
bool transparent;
bool vsync;
bool aa;
scene::IAnimatedMesh* quakeLevel;
scene::ISceneNode* lightMapNode;
......
......@@ -26,6 +26,7 @@ int main(int argc, char* argv[])
bool shadows = false;
bool additive = false;
bool vsync = false;
bool aa = false;
#ifndef _IRR_WINDOWS_
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
......@@ -36,10 +37,10 @@ int main(int argc, char* argv[])
CMainMenu menu;
//#ifndef _DEBUG
if (menu.run(fullscreen, music, shadows, additive, vsync, driverType))
if (menu.run(fullscreen, music, shadows, additive, vsync, aa, driverType))
//#endif
{
CDemo demo(fullscreen, music, shadows, additive, vsync, driverType);
CDemo demo(fullscreen, music, shadows, additive, vsync, aa, driverType);
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