Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members Related Pages
Lesson1: How to get started. - In this lesson you will learn how to create a window. Everything is pretty well commented so just follow the code. There are very few concepts one should know:
- First one is event driven way of interaction for your application. All your application is doing is responding on the events (like drawing, key pressing and so on). Each event has its handler (member function). When you want to do your staff in case of event you override this event. You create one class where you do whatever you want.
- Second one is, glut is used by default, so everything is wrapped around glut. The good thing is, you should not care about what is underneath. The concept is to give you ability to put everything you need in your class so you can use it!
- The third one, is that you must have one space window class (usually, but not necessary, called CSpcWnd), which will be receiving all events. If you want to process any of them, you override the corresponding event handler (usually, started with OnXXX, like, OnDraw() ). If you need to change the order in which events are processed by child objects you can override event handler directly (in case of drawing example, you could override Draw() method ).
- And the last one but not least. To get started easily we will use glut library, to create and transform windows, but you can use anything else, like MFC, or os specific API functions. How it can be done is covered in next tutorials.
- See also:
- sjgui
#include <sjgui/sjgui.h>
class CSpcWnd : public sjgui::CWnd
{
};
int main(int argc, char* argv[])
{
CSpcWnd SpcWnd;
SpcWnd.PosWnd(20,50,320,240);
if(sjgui::Create("Just a window!",&SpcWnd))
{
sjgui::GlobalMainLoop();
}
else
printf("Could not create opengl window.\n");
return 0;
}
Forward to Lesson 2.
|
|