When screen ratio match the ratio of your screen it is also possible to enable FullScreen and Vsync.
Actually I have implemented only several screen ratios wich are enumered:
4:3
16:9
15:9
20:9
unknown. (you can easily add more screen ratios if I forget some one)
When running your game in debug mode
(so when _DEBUG is defined) the full screen mode is turned off automatically. (this is usefull because lots of IDEs can have problem or crash while calling break points using DX drivers)
All you have todo is download the following package:
http://sourceforge.net/projects/agamete ... p/download
All the files have to be included. main.cpp is only an example file so you don't need it.
if you want to know if something goes wrong when running this code you need only to search for "BREAK_POINT" keywords and set up a break point there with your IDE.

HOW TO USE?
This is very simple.
1) Import files in your project
2) Set up break points (optional) as explained immediatly above
3) this is an example code using this class:
main.cpp:
Code: Select all
#include <irrlicht.h>
#include "IChoiceScreen.h"
//using namespaces is not obbligatory now
irr::s32 main()
{
isgf::IChoiceScreen set;
if(!set.choiceScreen()) //show the Video Mode selection screen
return -1; //BREAK_POINT you exited the app
IrrlichtDevice *device=set.createDeviceFromMe();
//now irrlicht device is initied and you can do what you want
//...
return 0;
}
the popup window is rendered with burnings video and you can select the option to don't show it again. All settings are loaded (and saved too) from a "config.xml" file wich contains additional infos about your pc.
So you can choose your favourite settings and then never warry again about that. When debugging your game, full screen is disabled. You can also set up the name of your game in the config file specifing your license type.
THANKS:
in the code there are some additional thanks to people who contributed directly or indirectly to this class.. If you want to be removed from thanks just tell me
There are lots of improvements that can be done to this class. Any suggestion from experienced programmers is wellcome.
LICENSE:
Zlib
COMPABILITY:
this code should work with any platform supported by irrlicht. If you use a compiled version without certain drivers, checkboxs referring to unsupported drivers are removed by pre-compiler directives.
An example config file generated by this code:
Code: Select all
<?xml version="1.0"?>
<config>
<game Name="myGame" Version="0.1" Author="me" License="Zlib" />
<screen Width="800" Height="600" ColorDepth="32" FullScreen="1" />
<options VSync="0" Shadows="0" AntiAlias="0" ShowNextTime="0" />
<driver Type="d3d9" />
<!--supported drivers are: d3d8, d3d9, opengl, burn, software-->
<!--
Your System Info:
OS version: Microsoft Windows Vista Personal Service Pack 2 (Build 6002)
CPU speed: 2000 MHz
Memory available: 1174836 / 2097151 KiloBytes
Irrlicht version: 1.7.1 (Irrlicht is Copyright (C) by Nikolaus Gebhardt)
-->
</config>