*//*
Procedural Overview
Code Diving!
To start off, the "xrb.hpp" header MUST be included in every source and header file, as it contains definitions necessary for the correct usage and operation of the game engine.
*/ #include "xrb.hpp" #include "xrb_screen.hpp" // For use of the necessary Screen widget class. #include "xrb_sdlpal.hpp" // For use of the SDLPal platform abstraction layer. /*
Xrb namespace. Although this is pedantic, it is used to avoid any possible naming collision. It turns out not to be inconvenient, because of C++'s using keyword. This using statement is used so we don't need to qualify every library type/class/etc with Xrb:: */ using namespace Xrb; // This is just a helper function to group all the shutdown code together. void CleanUp () { fprintf(stderr, "CleanUp();\n"); // Shutdown the platform abstraction layer. Singleton::Pal().Shutdown(); // Shutdown the game engine singletons. This is necessary for the // game engine to shutdown cleanly. Singleton::Shutdown(); } int main (int argc, char **argv) { fprintf(stderr, "main();\n"); /*
*/
Singleton::Initialize(SDLPal::Create, "none");
/*
*/
if (Singleton::Pal().Initialize() != Pal::SUCCESS)
return 1;
Singleton::Pal().SetWindowCaption("XuqRijBuh Lesson 00");
/*
*/
Screen *screen = Screen::Create(
800, // video mode/screen width
600, // video mode/screen height
32, // video mode pixel bitdepth
false); // not fullscreen -- for now
/*
*/
if (screen == NULL)
{
// this shuts down the Pal and singletons.
CleanUp();
// return with an error value.
return 2;
}
/*
*/
{
fprintf(stderr, "pausing for 5000 milliseconds...\n");
Singleton::Pal().Sleep(5000);
}
/*
*/
Delete(screen);
// this shuts down the Pal and the singletons.
CleanUp();
// return with success value.
return 0;
}
/*
Exercises
false -- to true. This will cause the application to be run in fullscreen mode. Make sure not to use fullscreen mode while developing/debugging, because hitting a breakpoint while in fullscreen video mode will make your computer a touch ornery. true (indicating fullscreen is enabled), change the video mode width, height and bitdepth to various values, seeing what video modes are supported by your hardware. Thus concludes lesson00. Did it hurt? The fuck it didn't.
1.5.8