#ifndef _CORE_H #define _CORE_H // Abstract API definition of RAVEN Core. #include "common.h" #include "keymap.h" using namespace std; // video and window mode flags #define RAVEN_FULLSCREEN 0x1 #define RAVEN_RESIZABLE 0x2 #define RAVEN_NODEPTHBUFFER 0x4 // video types. I should really put these in an enum. #define RAVEN_OPENGL 1 #define RAVEN_DIRECT3D9 2 class Core { protected: char *title; unsigned int width,height; int colorsize,depthsize; int flags; RAVEN_key_map *keymap; bool keys[RAVEN_KEY_CODE_COUNT]; bool buttons[8]; bool isappterm; bool isresized; double mousex,mousey; int coretype; // main constructor for use with CoreFactory friend class CoreFactory; Core(char *title,unsigned int width,unsigned int height,int colorsize,int depthsize,int flags); public: virtual ~Core(); virtual bool Start()=0; // initialize API for use virtual bool Stop()=0; // deinitialize API before deleting virtual unsigned int GetTitleLength(); // get the title length so we know how long the buffer we feed GetTitle must be virtual void GetTitle(char *title); // copy the title in to a user buffer virtual unsigned int GetWidth(); // get the width of the window virtual unsigned int GetHeight(); // get the height of the window virtual int GetColorBufferDepth(); // get the color buffer depth (16, 24, or 32) virtual int GetDepthBufferDepth(); // get the depth buffer size (16, 24, or 32) virtual int GetFlags(); // get the whole mess of flags virtual bool GetFlag(int flag); // get the boolean truth of a flag virtual bool Update()=0; // update; this handles events and updates the display virtual bool KeyDown(RAVEN_KEY_CODE key); // if the key of the keycode given is held down it returns true virtual bool ButtonDown(int button); // if the mouse button of the button index is held down it returns true virtual bool IsAppTerm(); // true if an app term event is received (hotkeys like alt+f4 pressed or [X] clicked etc.) virtual bool IsResized(); // true if the window was resized. returns to false after returning true ONCE. virtual double GetMouseX(); // returns a normalized floating point MouseX value. virtual double GetMouseY(); // returns a normalized floating point MouseY value. virtual int GetType(); // is this an OpenGL or Direct3D context? }; #endif