Advertisement
Guest User

App.h

a guest
Jun 4th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.84 KB | None | 0 0
  1. //==============================================================================
  2. /*
  3.     Primary application class
  4.  
  5.     3/11/2014
  6.     SDLTutorials.com
  7.     Tim Jones
  8. */
  9. //==============================================================================
  10.  
  11. #ifndef __APP_H__
  12.     #define __APP_H__
  13.  
  14. #include "../openglinc.h"
  15.  
  16. #include "../linkedList.h"
  17. #include "../Core/game.h"
  18. #include "../Core/Graphics/renderer.h"
  19. #include "input.h"
  20. #include "painter.h"
  21.  
  22. #define SCREENW 640.0
  23. #define SCREENH 360.0
  24.  
  25. #define WIDTH 32.0
  26. #define HEIGHT 24.0
  27. #define DEPTH 24.0
  28.  
  29. namespace LIB {
  30.  
  31.     class App {
  32.         protected:
  33.  
  34.             bool Running = true;
  35.             bool Initialized = false;
  36.  
  37.             CORE::Game* game;
  38.             Painter* painter;
  39.  
  40.  
  41.             GLuint programID;
  42.             GLuint terrainID;
  43.  
  44.             GLuint renderedTexture;
  45.  
  46.             GLuint MatrixID;
  47.  
  48.             unsigned cols = 10;
  49.             unsigned rows = 10;
  50.             unsigned numtiles = cols*rows;
  51.             unsigned numplayers = 1;
  52.  
  53.  
  54.  
  55.             GLuint VertexVBOID;
  56.             GLuint IndexVBOID;
  57.  
  58.             GLuint VertexPLAYERID;
  59.             GLuint IndexPLAYERID;
  60.  
  61.             GLuint bufferID;
  62.  
  63.             sf::Clock clock;
  64.  
  65.             float camdir;
  66.             float camdir_ang;
  67.  
  68.  
  69.             float deltaTime;
  70.  
  71.             sf::RenderWindow window;
  72.  
  73.             static const int WindowWidth = CORE::Game::screenW;
  74.             static const int WindowHeight = CORE::Game::screenH;
  75.  
  76.         public:
  77.  
  78.             sf::RenderWindow* get_window();
  79.  
  80.             // Initialize our SDL game / app
  81.             bool Init();
  82.  
  83.             // Logic loop
  84.             void Loop();
  85.  
  86.             // Capture Events
  87.             void Input();
  88.  
  89.             // Test if game should close
  90.             bool IsRunning();
  91.             // Test if game should init
  92.             bool IsInitialized();
  93.  
  94.             // Shutdown game
  95.             void Terminate();
  96.  
  97.             // Render loop (draw)
  98.             void Render();
  99.             void Render(int ox, int oy);
  100.  
  101.             // Free up resources
  102.             void Cleanup();
  103.         protected:
  104.  
  105.             LIB::Input inp;
  106.  
  107.             double offsetX, offsetY;
  108.  
  109.             double x, y, w, h;
  110.             int frame, frames, anim;
  111.             int dir, dirs;
  112.  
  113.             double anim_sp, anim_n;
  114.  
  115.             double speed;
  116.             double velX, velY;
  117.             double accX[8], accY[8];
  118.             double friX, friY;
  119.  
  120.             bool UP, DOWN, LEFT, RIGHT;
  121.  
  122.  
  123.         public:
  124.             App();
  125.             ~App();
  126.             void Execute(bool edit, sf::WindowHandle);
  127.  
  128.             // Move display here
  129.             void SetCamera(int ox, int oy);
  130.  
  131.         public:
  132.  
  133.             static int GetWindowWidth();
  134.             static int GetWindowHeight();
  135.     };
  136.  
  137.  
  138. }
  139.  
  140.  
  141. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement