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:
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:
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:
- Code: Select all
//using namespaces is not obbligatory now
if(!set.choiceScreen()) //show the Video Mode selection screen
return -1; //BREAK_POINT you exited the app
//now irrlicht device is initied and you can do what you want
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.
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.
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
<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)