Oxygine  1
2g game engine
oxygine.h
1 #pragma once
2 #include "oxygine-include.h"
3 #include "../EventDispatcher.h"
4 #include "math/Vector2.h"
5 #include <string>
6 
7 #if OXYGINE_SDL
8 typedef void* SDL_GLContext;
9 typedef struct SDL_Window SDL_Window;
10 typedef SDL_Window* window;
11 #else
12 typedef int window;
13 #endif
14 
16 namespace oxygine
17 {
18  class ThreadDispatcher;
19 
20  void* fastAlloc(size_t size);
21  void fastFree(void* data);
22 
23  typedef int timeMS;
24 
26  timeMS getTimeMS();
27 
29  int64 getTimeUTCMS();
30 
32  bool isNetworkAvailable();
33 
34 
35  int64 getFreeSpace(const char* fullpath = 0);
36 
38  std::string getLanguage();
39 
40 
42  void sleep(timeMS);
43 
44 
45  namespace core
46  {
47  struct init_desc
48  {
49  init_desc() : mode24bpp(true), w(-1), h(-1), fullscreen(false), title("Oxygine"), vsync(true), appName(0), companyName(0), force_gles(false) {}
50 
52  bool mode24bpp;
54  int w;
56  int h;
58  bool vsync;
60  bool fullscreen;
62  const char* title;
63 
65  const char* appName;
67  const char* companyName;
68 
70  bool force_gles;
71  };
72 
73  void init0();
74 
76  int init(init_desc* desc = 0);
77 
79  void release();
80 
82  void requestQuit();
83 
85  void reset();
86 
88  void restore();
89 
91  bool update();
92 
94  bool isReady2Render();
96  bool beginRendering(window i = 0);
97 
99  void swapDisplayBuffers(window i = 0);
100 
102  void execute(const char* url);
103 
105  std::string getPackage();
106 
108  Point getDisplaySize();
109 
110  ThreadDispatcher& getMainThreadDispatcher();
111  ThreadDispatcher& getUiThreadMessages();
112 
113  bool isActive();
114  bool hasFocus();
115 
116  bool isMainThread();
117 
118 
119 #ifdef OXYGINE_SDL
120  SDL_GLContext getGLContext();
121  SDL_Window* getWindow();
122 #endif
123 
124  enum
125  {
126  EVENT_SYSTEM = sysEventID('c', 'S', 'y'), //events from SDL
127  EVENT_PRECREATEWINDOW = sysEventID('c', 'P', 'W'),//dispatched before creating window/context
128  EVENT_EXIT = sysEventID('c', 'E', 'x'), //dispatched from core::release
129  };
130 
131  spEventDispatcher getDispatcher();
132 
133  void init0();
134  }
135 }
const char * appName
Definition: oxygine.h:65
int64 getTimeUTCMS()
Definition: oxygine.h:47
const char * title
Definition: oxygine.h:62
int w
Definition: oxygine.h:54
void sleep(timeMS)
timeMS getTimeMS()
bool fullscreen
Definition: oxygine.h:60
bool force_gles
Definition: oxygine.h:70
Definition: ThreadDispatcher.h:45
–oxgl-end–!
Definition: Actor.h:14
bool mode24bpp
Definition: oxygine.h:52
std::string getLanguage()
int h
Definition: oxygine.h:56
bool vsync
Definition: oxygine.h:58
const char * companyName
Definition: oxygine.h:67
bool isNetworkAvailable()