src/Application.hh
author Tero Marttila <terom@fixme.fi>
Tue, 20 Jan 2009 23:30:18 +0200
changeset 408 e6cfc44266af
parent 397 13fa0546ef87
child 409 1a03ff151abc
permissions -rw-r--r--
reorganize Terrain/PhysicsWorld/GameState/Engine to use NetworkClientConnect, and hence handle the connection process asynchronously, and finally properly implement receiving the terrain data from the server
#ifndef APPLICATION_HH
#define APPLIATION_HH

#include "Engine.hh"
#include "Error.hh"

#include <ClanLib/core.h>
#include <ClanLib/application.h>

class ArgumentError : public Error {
    public:
        ArgumentError (const std::string &message) : Error(message) { }
};

/**
 * Our CL_ClanApplication. Provides our main function, handles argument parsing and interacts with Engine
 */
class Main : public CL_ClanApplication {
    private:
        // arguments
        CL_CommandLine args;
        
        /**
         * --graphics
         */
        bool arg_graphics;

        /**
         * --port
         */
        std::string arg_port;

        /**
         * --server
         */
        bool arg_server;

        /**
         * --connect
         */
        std::string arg_connect;

        /**
         * --fullscreen and --resolution
         */
        GraphicsConfiguration graphics;

        /**
         * Set the arg_* members
         *
         * @return true if execution should proceed, false if execution should stop
         */
        bool parse_args (int argc, char **argv);

        /**
         * Parse and set --resolution/arg_resolution WIDTHxHEIGHT
         */
        void parse_arg_resolution (const std::string &val);
        
        /**
         * Print out a list of display modes
         */
        void dump_display_modes (void);
        
        /**
         * Print out our project version
         */
        void dump_version (void);

    public:
        /**
         * IT BEGAN IN AFRIKA
         */
        virtual int main (int argc, char **argv);
} app;

#endif