view TaskManager/Test/test_render/viewer.h @ 431:b40a9b901d71 draft

fix
author game@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 24 Sep 2009 20:43:14 +0900
parents 6094dfd1f08c
children 7705fa2025da
line wrap: on
line source

#ifndef INCLUDED_VIEWER
#define INCLUDED_VIEWER

#include <SDL.h>

#include "viewer_types.h"
#include "TaskManager.h"
#include "KeyStat.h"

class Viewer {
public:
    //Viewer(TaskManager *manager, int bpp, int width, int height, int spenum);
    Viewer(int bpp, int width, int height, int spenum);

    virtual ~Viewer(void) {}

    //Application *application;

    TaskManager *manager;
    key_stat *keyPtr;

    /* screen info */
    int width;
    int height;
    int bpp;

    int spe_num;

    int rgb_size[3];
    Uint32 video_flags;
    Uint32 *pixels;

    virtual void video_init(TaskManager *manager) = 0;
    void init();

    int get_ticks();
    bool quit_check();
    void quit();

    virtual void swap_buffers();
    virtual void clean_pixels() {}

    virtual void run_init(TaskManager *manager, const char *xml, int sg_number);
    virtual void run_loop(HTaskPtr task_next);
    virtual void run_draw(HTaskPtr task_next);
    virtual void run_finish();
    virtual void run_move(HTaskPtr task_next);
    virtual void run_collision();
    virtual void rendering(HTaskPtr task_next);
    //virtual void exchange_sgroot(TaskManager *manager);

    void getKey();
    void get_send_controll();
private:
    HTaskPtr initLoop();
    void mainInit();
    void speInit();

};

#define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK


#endif