made header guards follow the google c++ standards and switched to the #ifndef style instead of using pragmas
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -53,6 +53,7 @@
|
||||
"variant": "cpp",
|
||||
"condition_variable": "cpp",
|
||||
"mutex": "cpp",
|
||||
"valarray": "cpp"
|
||||
"valarray": "cpp",
|
||||
"map": "cpp"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _INCLUDE_COLOUR_H_
|
||||
#define _INCLUDE_COLOUR_H_
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@@ -61,3 +62,5 @@ public:
|
||||
std::cout << "\033[" << colour << "m";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _INCLUDE_LOGGER_H_
|
||||
#define _INCLUDE_LOGGER_H_
|
||||
|
||||
#include <time.h>
|
||||
#include <colour.h>
|
||||
@@ -70,3 +71,5 @@ private:
|
||||
return stream.str();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#pragma once
|
||||
#ifndef _CRUMPET_ENGINE_H_
|
||||
#define _CRUMPET_ENGINE_H_
|
||||
|
||||
#include "game.h"
|
||||
#include <math.h>
|
||||
#include <logger.h>
|
||||
|
||||
#undef main
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _ENTITYMANAGER_ENTITY_H_
|
||||
#define _ENTITYMANAGER_ENTITY_H_
|
||||
|
||||
#include "entitybase.h"
|
||||
|
||||
@@ -8,3 +9,5 @@ public:
|
||||
|
||||
virtual ~Entity();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _ENTITYMANAGER_BASE_H_
|
||||
#define _ENTITYMANAGER_BASE_H_
|
||||
|
||||
#include <string>
|
||||
#include "../math.h"
|
||||
@@ -9,7 +10,7 @@ class EntityBase {
|
||||
public:
|
||||
EntityBase();
|
||||
|
||||
SDL_Texture* texture;
|
||||
Texture* texture;
|
||||
|
||||
virtual ~EntityBase();
|
||||
private:
|
||||
@@ -17,3 +18,5 @@ private:
|
||||
std::string textureSource;
|
||||
Vec2<int> textureDimensions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _ENTITYMANAGER_ENTITYMANAGER_H_
|
||||
#define _ENTITYMANAGER_ENTITYMANAGER_H_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -16,3 +17,5 @@ private:
|
||||
std::map<unsigned short int, Entity*> m_activeEntities;
|
||||
ResourceManger* resourceManger;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _GAME_H_
|
||||
#define _GAME_H_
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -25,3 +26,5 @@ public:
|
||||
|
||||
virtual ~Game();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _INPUT_INPUT_H_
|
||||
#define _INPUT_INPUT_H_
|
||||
|
||||
#include <vector>
|
||||
#include <SDL2/SDL.h>
|
||||
@@ -20,3 +21,5 @@ private:
|
||||
SDL_Event m_event;
|
||||
Renderer* m_renderer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _INPUT_KEYBOARD_H_
|
||||
#define _INPUT_KEYBOARD_H_
|
||||
|
||||
typedef enum {
|
||||
KEY_A,
|
||||
@@ -48,6 +49,7 @@ typedef enum {
|
||||
class Keyboard {
|
||||
public:
|
||||
Key lastOutput = KEY_SPACE;
|
||||
|
||||
|
||||
// do this with states
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef _INPUT_MOUSE_H
|
||||
#define _INPUT_MOUSE_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
|
||||
const float DEG2RAD = 0.01745329251994329576923690768f;
|
||||
const float RAD2DEG = 57.2957795130823208767981548141f;
|
||||
@@ -218,3 +219,5 @@ struct Vec2 {
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _RECT_H_
|
||||
#define _RECT_H_
|
||||
|
||||
#include <string>
|
||||
#include <SDL2/SDL.h>
|
||||
@@ -68,3 +69,5 @@ public:
|
||||
private:
|
||||
SDL_Rect* rect;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _RENDERENGINE_RENDERER_H_
|
||||
#define _RENDERENGINE_RENDERER_H_
|
||||
|
||||
#include <logger.h>
|
||||
#include <string>
|
||||
@@ -26,3 +27,5 @@ private:
|
||||
SDL_Window* m_window;
|
||||
bool m_isWindowClosed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _RESOURCEMANAGER_RESOURCEMANAGER_H_
|
||||
#define _RESOURCEMANAGER_RESOURCEMANAGER_H_
|
||||
|
||||
#include "texturemanager.h"
|
||||
|
||||
@@ -10,3 +11,5 @@ public:
|
||||
|
||||
virtual ~ResourceManger() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,11 @@ void TextureManager::unregisterTexture(std::string textureName) {
|
||||
delete &m_registerdTextures[textureName];
|
||||
}
|
||||
|
||||
SDL_Texture* TextureManager::getTexture(std::string textureName) {
|
||||
Texture* TextureManager::getTexture(std::string textureName) {
|
||||
return m_registerdTextures[textureName];
|
||||
}
|
||||
|
||||
SDL_Texture* TextureManager::getSDLTexture(std::string textureName) {
|
||||
return m_registerdTextures[textureName]->texture;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef _RESOURCEMANAGER_TEXTUREMANAGER_H_
|
||||
#define _RESOURCEMANAGER_TEXTUREMANAGER_H_
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
@@ -24,7 +25,8 @@ public:
|
||||
|
||||
bool registerTexture(std::string textureSource, std::string textureName);
|
||||
void unregisterTexture(std::string textureName);
|
||||
SDL_Texture* getTexture(std::string textureName);
|
||||
Texture* getTexture(std::string textureName);
|
||||
SDL_Texture* getSDLTexture(std::string textureName);
|
||||
std::string getTextureSource(std::string textureName);
|
||||
|
||||
virtual ~TextureManager();
|
||||
@@ -32,3 +34,5 @@ private:
|
||||
std::map<std::string, Texture*> m_registerdTextures;
|
||||
Renderer* m_renderer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ int main(int argc, char** argv) {
|
||||
game.input.poll();
|
||||
Rect rectfrom(0, 0, 1000, 1000);
|
||||
Rect rectTo(-300, 0, 1000, 1000);
|
||||
SDL_RenderCopy(game.renderer.SDLRenderer, game.textureManager.getTexture("mario"), rectfrom.ToSDLRect(), rectTo.ToSDLRect());
|
||||
SDL_RenderCopy(game.renderer.SDLRenderer, game.textureManager.getSDLTexture("mario"), rectfrom.ToSDLRect(), rectTo.ToSDLRect());
|
||||
game.renderer.update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user