added resources and changed textures
This commit is contained in:
Binary file not shown.
BIN
bin/resources/eldritch-ts.png
Normal file
BIN
bin/resources/eldritch-ts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -1,8 +1,7 @@
|
||||
#include "entitybase.h"
|
||||
|
||||
EntityBase::EntityBase()
|
||||
: textureDimensions(0, 0) {
|
||||
|
||||
EntityBase::EntityBase() {
|
||||
|
||||
}
|
||||
|
||||
EntityBase::~EntityBase() {
|
||||
|
||||
@@ -14,9 +14,6 @@ public:
|
||||
|
||||
virtual ~EntityBase();
|
||||
private:
|
||||
std::string textureRef;
|
||||
std::string textureSource;
|
||||
Vec2<int> textureDimensions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "texturemanager.h"
|
||||
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
TextureManager::TextureManager(Renderer* renderer) {
|
||||
m_renderer = renderer;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
#define _RESOURCEMANAGER_TEXTUREMANAGER_H_
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <logger.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <logger.h>
|
||||
#include <math.h>
|
||||
#include "../renderengine/renderer.h"
|
||||
|
||||
struct Texture {
|
||||
@@ -17,6 +18,11 @@ struct Texture {
|
||||
std::string name;
|
||||
std::string source;
|
||||
SDL_Texture* texture;
|
||||
// Vec2<int>* textureDimensions;
|
||||
};
|
||||
|
||||
struct TextureMap {
|
||||
std::vector<Texture*> textures;
|
||||
};
|
||||
|
||||
class TextureManager {
|
||||
|
||||
@@ -7,14 +7,14 @@ int main(int argc, char** argv) {
|
||||
Game game;
|
||||
game.renderer.createWindow("Crumpet Engine", 600, 400, SCREEN_MODE_VSYNC);
|
||||
|
||||
game.textureManager.registerTexture("./resources/mario.png", "mario");
|
||||
game.textureManager.registerTexture("./resources/eldritch-ts.png", "Eldritch");
|
||||
|
||||
while (!game.renderer.isWindowClosed()) {
|
||||
game.renderer.clear();
|
||||
game.input.poll();
|
||||
Rect rectfrom(0, 0, 1000, 1000);
|
||||
Rect rectTo(-300, 0, 1000, 1000);
|
||||
SDL_RenderCopy(game.renderer.SDLRenderer, game.textureManager.getSDLTexture("mario"), rectfrom.ToSDLRect(), rectTo.ToSDLRect());
|
||||
Rect rectfrom(0, 0, 100, 100);
|
||||
Rect rectTo(0, 0, 400, 400);
|
||||
SDL_RenderCopy(game.renderer.SDLRenderer, game.textureManager.getSDLTexture("Eldritch"), rectfrom.ToSDLRect(), rectTo.ToSDLRect());
|
||||
game.renderer.update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user