Troll2D
From Wikipedia, the free encyclopedia
This article may not meet the notability guideline for web content. If you are familiar with the subject matter, please expand or rewrite the article to establish its notability. The best way to address this concern is to reference published, third-party sources about the subject. If notability cannot be established, the article is more likely to be considered for redirection, merge or ultimately deletion, per Wikipedia:Guide to deletion. This article has been tagged since June 2008. |
Troll | |
---|---|
Logo |
|
Developed by | JarinSoft |
Latest release | 0.0.1 / May 31, 2008 unstable |
Written in | C++ |
OS | Cross-platform |
Genre | Multimedia and Games SDK / API |
License | BSD licenses |
Website | http://troll2d.googlecode.com |
Troll is a free and open source software library for video game development, with functions for basic 2D graphics, image manipulation, text output, audio output, midi music, input and timers. Troll is written in C++ and is full Object-oriented, and easy to use. Internally is used Allegro or SDL as back-end for the low level manipulations of video, audio, input. But the system of modules is possible to create your own-backend.
Contents |
[edit] Sample Code
Game entry point, and main loop
int main() { using namespace Troll; if(!System::Init()) // Initialize system return 1; if(!System::SetupScreen()) // Create screen return 1; Surface & screen = Screen::GetSurface(); // Get surface screen Graphics g(screen); // Create a Graphics object while(!KeyInput::IsKeyDown(Key::ESCAPE)) // key-esc was not pressed { g.DrawRect(Rect(10,10,200,200),Color(255,0,0)); // Draw a Rect Screen::Flip(); // Draw to screen (page flip, or blit) } return 0; }
This code is a main loop of game, and draw a red rectagle until ESC key is pressed
[edit] History
Troll was design to abstract and help to wrote games quickly. The main idea is encapsulate common tasks to write a game, and make easy write a game in a few lines of code. Troll supports Unix (Linux, FreeBSD, Irix, Solaris, Darwin), Windows, BeOS, QNX, Mac OS X, and DOS, Symbian, Windows Mobile. (and any plataform that suppors SDL or Allegro)