Development/Tutorials/Games/KGLEngine2d: Difference between revisions
(New page: <div class="rbroundbox" style="width:100%;"> <div class="rbtopwrap"> <div class="rbtop"><div></div></div>{{{KGLEngine2d tutorial}}}</div> <div class="rbcontent"> {|style="width:100%; b...) |
No edit summary |
||
Line 37: | Line 37: | ||
#include <KCmdLineArgs> | #include <KCmdLineArgs> | ||
#include " | #include "pongengine.h" | ||
int main( int argc, char **argv) | int main( int argc, char **argv) | ||
{ | { | ||
Line 52: | Line 53: | ||
KApplication app; | KApplication app; | ||
pongEngine pong; | |||
pong.show(); | |||
return app.exec();; | |||
return app.exec(); | |||
} | } | ||
</code> | </code> | ||
So, what are we doing ? | So, what are we doing ? | ||
Initializing the KApplication, and creating an instance of one | Initializing the KApplication, and creating an instance of our main class, the one that surclasses KGLEngine2d. Then we tell him to show himself, and that's all. I told you there was nothing exciting in here :) | ||
==The KGLEngine2d pong engine== | |||
TODO: finish this :p | TODO: finish this :p | ||
</noinclude> | </noinclude> |
Revision as of 22:12, 10 October 2008
Tutorial Series | KGLEngine2d developement |
Prerequisites | None |
What's Next | Nothing at the moment |
Further Reading | KGLEngine2d's code |
Abstract
KGLEngine2d is a recent try to develop a 2D games engine using openGL, and powerful enough to deliver complex and beautiful games. As of now, version 1.0 is not even out, but the API is stable enough for anyone to start playing with the engine. Through this tutorial I will explain how to use a great part of the engine, included but not limited to : sprites creation, rotation and deplacement and collision detection.
The example : kglPong
Anyone who have followed the KGLEngine2d developement a bit will have seen some kglPong screenshot, as this is the way new features are shown, using this simple game to showcase them.
Starting Point : the main.cpp
Every application need one, so let's start with it, as it really is simple.
- include <KApplication>
- include <KAboutData>
- include <KCmdLineArgs>
- include "pongengine.h"
int main( int argc, char **argv)
{
KAboutData aboutData( "kglpong", 0,
ki18n("kglpong"), "0.1",
ki18n("Classic pong game using KGLEngine2d"),
KAboutData::License_GPL,
ki18n("Copyright (c) 2008 Developer") );
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
pongEngine pong;
pong.show();
return app.exec();;
}
So, what are we doing ?
Initializing the KApplication, and creating an instance of our main class, the one that surclasses KGLEngine2d. Then we tell him to show himself, and that's all. I told you there was nothing exciting in here :)
The KGLEngine2d pong engine
TODO: finish this :p