Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

tut1.cpp

TUTORIAL 1 - application initialization, eventloop

/*
    ParaGUI - crossplatform widgetset
    
    TUTORIAL 1 - application initialization, eventloop

    Copyright (C) 2000  Alexander Pipelka

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    Alexander Pipelka
    pipelka@teleweb.at

    Last Update:      $Author: pipelka $
    Update Date:      $Date: 2001/01/31 17:23:17 $
    Source File:      $Source: /usr/local/CVSROOT/linux/paragui/doc/html/tut1_cpp-example.html,v $
    CVS/RCS Revision: $Revision: 1.10 $
    Status:           $State: Exp $
*/

#include "sdlapplication.h"

int main(int argc, char* argv[]) {

    // every ParaGUI application need an application-object
    SDLApplication app;

    // every application needs a theme (the look & feel of the widgets)
    app.LoadTheme("default");

    // we must initialize the screen where we want to draw on

    // 640 - screen width
    // 480 - screen height
    // 16 - bitdepth (hicolor)
    // SDL_SWSURFACE - SDL option to generate surface in system memory

    app.InitScreen(640, 480, 16, SDL_SWSURFACE);

    // ok - now we have a nice 640x480x16 window on the screen :)

    // Every ParaGUI application is event driven, so we need a loop where
    // we process all events (like mouse handling, keystrokes,...)

    // usually this is done with SDLApplication::Run()

    app.Run();

    // this function will only exit when the application was closed

    return 0;
}