This is an old revision of the document!
This application tests audio, the particle system, text input and buttons.
It illustrates how to use entities and components and is a good sample to “clone” when starting your own project.
You can compile and run it by following the directions from RTBareBones with one additional thing:
The default audio system for Windows is Audiere (thanks to rzuf). It compiles “out of the box” as its lib/dll files are included in Proton.
Don't want audio at all? If you look near the top of App.cpp you'll see where you could comment out AudioManagerAudiere g_audioManager and uncomment AudioManager g_audioManager. This is the dummy audio manager that doesn't actually play anything.
If for some reason you'd like to switch to the FMOD sound system, here is info on how to do that.
Uh oh, if you ran it you probably got an assert about being “unable to init”. If you check the MSVC output window you will see:
ERROR: Can't open interface/font_trajan.rtfont. Can't load font 1
What's going on? We forgot to build resources, if you look in the bin directory there is no audio or interface directories. Unlike RTBareBones, you have to run a script to build the font(s) and convert the images (mostly .pngs) to our own .rttex format.
Use file explorer to navigate to <proton dir>/RTSimpleApp/media and double click update_media.bat.
A command prompt will open processing all the files in the RTSimpleApp/media/interface tree and copy the 'final' versions to bin/interface. (audio and game dirs as well, although game will be empty)
You don't have to. But it's flexible. Would you like to see what the game looks like using 4 bit .pvr textures for your iPhone build? Easy, change a setting in update_media.bat and you can know. .oggs instead of .mp3s? 16 bit raw textures on Android except for a few important images that should be 32 bit? A .bat file makes it easy to specify things without ever really modifying your master resource files.
Or you may need non-square textures to be uncompressed, but square textures to be PVRTC compressed for speed for only a certain platform. (iPhone, cough) RTPack.exe is very powerful and can do this kind of thing with ease.
Remember, when you change a .png, you change it in media/*, and then must run update_media.bat to update the bin versions before you will see it in game. Android/iPhone/WebOS scripts will grab the media from the bin directory. (If you really hate that, yeah, you can just write bmps directly into the bin directory yourself, but you lose the advantages of RTPack.exe being able to convert from nearly any filetype to .rttex and other advantages like padding images to be power of two)
Processing is fast because the RTPack.exe processor can detect changes and only convert changed/new files.
Assuming you built your resources right, and you're using the profile “iPhone”, you'll see this. Uh oh, it's sideways because in App::Init() it has:
SetLockedLandscape(true); //we don't allow portrait mode for this game
This means it will force landscape mode. It will do a 180 flip if an iPhone is held upside down, but won't flip to portrait modes.
Before you sustain serious neck injury, change your profile to “iPhone Landscape”.
It should now look more like this:
Demonstration of using the particle system, click (will be touch, when on a device) the screen to add an explosion.
It also has options to turn on and off ogg/mp3 background music.
It also demonstrates one more interesting thing - auto stretching. This app was designed for 320×480 “primary size” (before rotated to landscape) but will automatically adjust input and rendering to any screen size thanks to a single line of text in its App.cpp:
To see the stretch in action, change the video mode in main.cpp “Nexus One”. You should see…
You should see it properly stretches things to match the screen size.