8 #include <export/Export.h>
10 #include <sx/SXParser.h>
14 #include <boost/unordered_map.hpp>
15 #include <boost/timer.hpp>
16 #include <boost/date_time/posix_time/posix_time.hpp>
17 using boost::posix_time::ptime;
18 using boost::posix_time::second_clock;
19 using boost::posix_time::to_simple_string;
21 using namespace boost;
51 SX_INSERT = 0x100000d,
55 SX_DELETE = 0x1000011,
56 SX_PAGEUP = 0x1000012,
57 SX_PAGEDOWN = 0x1000013,
62 SX_NUMLOCK = 0x1000018,
67 SX_CAPSLOCK = 0x100001d,
70 SX_RETURN = 0x1000020,
71 SX_BACKSPACE = 0x1000021
86 virtual double getTime()
const = 0;
92 virtual double getDeltaTime()
const = 0;
97 virtual int getMouseX()
const = 0;
102 virtual int getMouseY()
const = 0;
109 virtual double getMouseDeltaX()
const = 0;
116 virtual double getMouseDeltaY()
const = 0;
121 virtual bool hasKey(
int key)
const = 0;
126 virtual bool hasMouseKey(
MouseButton key)
const = 0;
131 virtual int getWidth()
const = 0;
136 virtual int getHeight()
const = 0;
141 virtual void stopRendering() = 0;
147 virtual void setMousePointer(
int x,
int y) = 0;
153 virtual void setShowCursor(
bool showCursor) = 0;
208 static map<int,int> keys_glut2sx;
210 static map<int,int> initKeys_glut2sx();
212 static map<int,int> keys_glutnotspecial2sx;
214 static map<int,int> initKeys_glutnotspecial2sx();
219 double currentTimeRendering;
224 double lastTimeRendered;
251 static double mouseDeltaX;
258 static double mouseDeltaY;
263 unordered_map<int,int> keys;
268 unordered_map<int,int> mouseKeys;
273 boost::timer timeMeasurement;
278 vector<SXRenderListener *> listeners;
283 vector<SXRenderListener *> initListeners;
300 void listenersReshape();
305 void listenersRender();
311 void listenersStop();
315 void setWidth(
int width);
317 void setHeight(
int height);
319 void setMouseX(
int x);
321 void setMouseY(
int y);
323 void addKey(
int key);
325 void removeKey(
int key);
345 static map<int, SXWindow *> windows;
364 friend void windowKeyUp(
unsigned char key,
int x,
int y);
366 friend void windowKeyDown(
unsigned char key,
int x,
int y);
368 friend void windowSpecialKeyUp(
int key,
int x,
int y);
370 friend void windowSpecialKeyDown(
int key,
int x,
int y);
372 friend void windowMouseKey(
int button,
int state,
int x,
int y);
374 friend void windowMouseMotion(
int x,
int y);
376 friend void windowPassiveMotion(
int x,
int y);
381 friend void reshapeAll(
int width,
int height);
386 friend void renderAll();
391 friend void stopAll();
399 EX
SXWindow(
const string &name,
unsigned int width,
unsigned int height);
410 EX
void removeWindow();
427 EX
void deleteRenderListeners();
432 EX
double getTime()
const;
437 EX
double getDeltaTime()
const;
442 EX
int getMouseX()
const;
447 EX
int getMouseY()
const;
452 EX
double getMouseDeltaX()
const;
457 EX
double getMouseDeltaY()
const;
462 EX
bool hasKey(
int key)
const;
472 EX
int getWidth()
const;
477 EX
int getHeight()
const;
484 EX
static void run();
489 EX
void stopRendering();
494 EX
void setMousePointer(
int x,
int y);
499 EX
void setShowCursor(
bool showCursor);
525 unordered_map<string,SXResource *> resources;
526 unordered_map<string,Shader *> shaders;
527 unordered_map<string,BufferedMesh *> bufferedMeshes;
528 unordered_map<string,Skeleton *> skeletons;
529 unordered_map<string,UniformFloat *> uniformFloats;
530 unordered_map<string,UniformDouble *> uniformDoubles;
531 unordered_map<string,UniformVector *> uniformVectors;
532 unordered_map<string,UniformDVector *> uniformDVectors;
533 unordered_map<string,UniformMatrix *> uniformMatrices;
534 unordered_map<string,UniformDMatrix *> uniformDMatrices;
535 unordered_map<string,Texture *> textures;
536 unordered_map<string,Volume *> volumes;
537 unordered_map<string,RenderTarget *> renderTargets;
538 unordered_map<string,RenderObject *> renderObjects;
539 unordered_map<string,Pass *> passes;
540 unordered_map<string,Effect *> effects;
541 unordered_map<string,AudioBuffer *> audioBuffers;
542 unordered_map<string,AudioObject *> audioObjects;
543 unordered_map<string,AudioListener *> audioListeners;
544 unordered_map<string,AudioPass *> audioPasses;
546 unordered_map<string,BufferUniforms> bufferUniforms;
558 void INTERNAL_LOAD_SHADER(
XTag *rNode,
XTag *data);
560 void INTERNAL_LOAD_MATRIXCONTENT(
Matrix &matrix,
const string &
id,
XTag *rNode,
XTag *data);
562 void INTERNAL_LOAD_DMATRIXCONTENT(
DMatrix &matrix,
const string &
id,
XTag *rNode,
XTag *data);
564 void INTERNAL_LOAD_VECTORCONTENT(
Vector &vec,
const string &
id,
XTag *rNode,
XTag *data);
566 void INTERNAL_LOAD_DVECTORCONTENT(
DVector &vec,
const string &
id,
XTag *rNode,
XTag *data);
568 void INTERNAL_LOAD_BUFFEREDMESH(
XTag *rNode,
XTag *data);
570 void INTERNAL_LOAD_SKELETON(
XTag *rNode,
XTag *data);
572 void INTERNAL_LOAD_UNIFORMFLOAT(
XTag *rNode,
XTag *data);
574 void INTERNAL_LOAD_UNIFORMDOUBLE(
XTag *rNode,
XTag *data);
576 void INTERNAL_LOAD_UNIFORMVECTOR(
XTag *rNode,
XTag *data);
578 void INTERNAL_LOAD_UNIFORMDVECTOR(
XTag *rNode,
XTag *data);
580 void INTERNAL_LOAD_UNIFORMMATRIX(
XTag *rNode,
XTag *data);
582 void INTERNAL_LOAD_UNIFORMDMATRIX(
XTag *rNode,
XTag *data);
584 void INTERNAL_LOAD_TEXTURE(
XTag *rNode,
XTag *data);
586 void INTERNAL_LOAD_VOLUME(
XTag *rNode,
XTag *data);
588 void INTERNAL_LOAD_RENDERTARGET(
XTag *rNode,
XTag *data);
590 void INTERNAL_LOAD_RENDEROBJECT(
XTag *rNode,
XTag *data);
592 void INTERNAL_RENDEROBJECT_COLLECT_UNIFORMS(
RenderObject &obj,
const string &
id,
const string &uType,
bool isUniformSet,
int uniformSetID,
XTag *rNode,
XTag *data);
594 void INTERNAL_LOAD_PASS(
XTag *rNode,
XTag *data);
596 void INTERNAL_PASS_COLLECT_UNIFORMS(
Pass &pass,
const string &
id,
const string &uType,
XTag *rNode,
XTag *data);
598 void INTERNAL_LOAD_EFFECT(
XTag *rNode,
XTag *data);
600 void INTERNAL_LOAD_AUDIOBUFFER(
XTag *rNode,
XTag *data);
602 void INTERNAL_LOAD_AUDIOOBJECT(
XTag *rNode,
XTag *data);
604 void INTERNAL_LOAD_AUDIOLISTENER(
XTag *rNode,
XTag *data);
606 void INTERNAL_LOAD_AUDIOPASS(
XTag *rNode,
XTag *data);
628 EX
void clear(
const string &
id);
642 EX
void addResourcesFromString(
const string &resources);
652 EX
void addResources(
const string &path);
674 EX
Shader &getShader(
const string &
id);
679 EX
void addResource(
const string &
id,
Shader &shader);
697 EX
void addResource(
const string &
id,
BufferedMesh &mesh);
710 EX
Skeleton &getSkeleton(
const string &
id);
715 EX
void addResource(
const string &
id,
Skeleton &skeleton);
733 EX
void addResource(
const string &
id,
UniformFloat &uFloat);
751 EX
void addResource(
const string &
id,
UniformDouble &uDouble);
769 EX
void addResource(
const string &
id,
UniformVector &uVector);
805 EX
void addResource(
const string &
id,
UniformMatrix &uMatrix);
836 EX
Texture &getTexture(
const string &
id);
841 EX
void addResource(
const string &
id,
Texture &texture);
854 EX
Volume &getVolume(
const string &
id);
859 EX
void addResource(
const string &
id,
Volume &volume);
877 EX
void addResource(
const string &
id,
RenderTarget &target);
895 EX
void addResource(
const string &
id,
RenderObject &
object);
908 EX
Pass &getPass(
const string &
id);
913 EX
void addResource(
const string &
id,
Pass &pass);
926 EX
Effect &getEffect(
const string &
id);
931 EX
void addResource(
const string &
id,
Effect &effect);
949 EX
void addResource(
const string &
id,
AudioBuffer &buffer);
967 EX
void addResource(
const string &
id,
AudioObject &
object);
985 EX
void addResource(
const string &
id,
AudioListener &
object);
998 EX
AudioPass &getAudioPass(
const string &
id);
1003 EX
void addResource(
const string &
id,
AudioPass &
object);
Definition: SXCore.h:2507
Definition: SXCore.h:1903
Definition: SXCore.h:2682
KeyboardSpecial
Definition: SX.h:37
Definition: SXCore.h:2260
Definition: SXCore.h:1568
MouseButton
Definition: SX.h:28
Definition: SXCore.h:3109
Definition: SXCore.h:3627
Definition: SXCore.h:1336
Definition: SXCore.h:3195
Definition: SXCore.h:3750
Definition: SXCore.h:3289
Definition: SXParser.h:337
Definition: Exception.h:13