dd_game.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef DD_GAME_H
  2. #define DD_GAME_H
  3. /* defines game-specific data that are used by the engine
  4. * but are configured from each individual game
  5. */
  6. // way to change the background clear colour
  7. extern float dd_clearcolor_r, dd_clearcolor_g, dd_clearcolor_b;
  8. //#define dd_clearColour(r, g, b, a) glClearColor(r, g, b, a)
  9. #define dd_clearColour(r, g, b, a) dd_clearcolor_r = r; dd_clearcolor_g = g; dd_clearcolor_b = b;
  10. #define dd_clearDepth() glClear(GL_DEPTH_BUFFER_BIT)
  11. // initialise all pre-game data
  12. void dd_gameInitDefault();
  13. extern void dd_gameInit();
  14. // game title and function to change it
  15. extern char *gameTitle;
  16. #define dd_setGameTitle(GAME_TITLE) gameTitle = GAME_TITLE;
  17. // game init size and function for it
  18. extern int dd_gameInitWindowWidth, dd_gameInitWindowHeight;
  19. #define dd_setInitWindowSize(w, h) dd_gameInitWindowWidth = w; dd_gameInitWindowHeight = h;
  20. // return screen limits on given `z`
  21. #if DD_PLATFORM_ANDROID
  22. extern int dd_width;
  23. extern int dd_height;
  24. #define dd_window_width() dd_width
  25. #define dd_window_height() dd_height
  26. #else
  27. #define dd_window_width() glutGet(GLUT_WINDOW_WIDTH)
  28. #define dd_window_height() glutGet(GLUT_WINDOW_HEIGHT)
  29. #endif
  30. float dd_screen_width_get (float z);
  31. float dd_screen_height_get(float z);
  32. // return distance from camera, based on given width or height
  33. float dd_screen_distance_getw(float width);
  34. float dd_screen_distance_geth(float height);
  35. // full screen
  36. #if DD_PLATFORM_NATIVE
  37. #define dd_fullscreenToggle() glutFullScreenToggle()
  38. #elif DD_PLATFORM_ANDROID
  39. #define dd_fullscreenToggle()
  40. #endif
  41. extern int dd_flag_initialised;
  42. extern int dd_flag_focused;
  43. extern int dd_flag_updateThread;
  44. extern int dd_flag_exit;
  45. #endif