Kdevelop included, libtmxparser excluded
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "MusicManager.h"
|
||||
#include "SDL2/SDL_mixer.h"
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
|
||||
Mix_Music* MusicManager::LoadMusic(const char* path){
|
||||
Mix_Music* music = Mix_LoadMUS(path);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define SRC_MUSICMANAGER_H_
|
||||
|
||||
#include "../game/Game.hpp"
|
||||
#include "../../libsdl2_mixer/SDL_mixer.h"
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
|
||||
class MusicManager
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define SRC_ECS_COLLIDERCOMPONENT_H_
|
||||
|
||||
#include <string>
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "Components.h"
|
||||
#include "ECS.h"
|
||||
#include "../assetmgr/TextureManager.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define SRC_ECS_SPRITECOMPONENT_H_
|
||||
|
||||
#include "Components.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../assetmgr/TextureManager.h"
|
||||
#include "Animation.h"
|
||||
#include <map>
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define SRC_ECS_TILECOMPONENT_H_
|
||||
|
||||
#include "ECS.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../assetmgr/AssetManager.h"
|
||||
|
||||
class TileComponent : public Component
|
||||
|
@ -9,20 +9,20 @@
|
||||
#define SRC_ECS_TILEMAPCOMPONENT_H_
|
||||
|
||||
#include "ECS.h"
|
||||
#include "../../libsdl2/include/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../assetmgr/AssetManager.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include "tmxparser.h"
|
||||
//#include "../../libtmx-parser/src/tmxparser.h"
|
||||
|
||||
class TileMapComponent : public Component
|
||||
{
|
||||
public:
|
||||
SDL_Texture* texture;
|
||||
SDL_Rect srcRect, destRect;
|
||||
tmxparser::TmxMap map;
|
||||
//tmxparser::TmxMap map;
|
||||
int globalScale;
|
||||
std::vector<SDL_Rect> tileSet;
|
||||
std::vector<SDL_Rect> destRects;
|
||||
@ -40,9 +40,9 @@ public:
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
TileMapComponent(tmxparser::TmxMap loadedMap, int gScale, int offsetX, int offsetY)
|
||||
TileMapComponent(/*tmxparser::TmxMap loadedMap,*/ int gScale, int offsetX, int offsetY)
|
||||
{
|
||||
map = loadedMap;
|
||||
/*map = loadedMap;
|
||||
std::string texturePath = "assets/textures/tiles/" + loadedMap.tilesetCollection[0].name + ".png";
|
||||
Game::assets->AddTexture(map.tilesetCollection[0].name, texturePath.c_str());
|
||||
setTex(map.tilesetCollection[0].name);
|
||||
@ -54,9 +54,9 @@ public:
|
||||
tileWidth = map.tileWidth;
|
||||
|
||||
// =========== Setup Tile Set ===========
|
||||
tileSetTotal = map.tilesetCollection[0].colCount*map.tilesetCollection[0].rowCount;
|
||||
tileSetTotal = map.tilesetCollection[0].colCount*map.tilesetCollection[0].rowCount;*/
|
||||
tileSet.resize(tileSetTotal);
|
||||
|
||||
/*
|
||||
for (int r=0;r<map.tilesetCollection[0].rowCount;r++){
|
||||
for (int c=0;c<map.tilesetCollection[0].colCount;c++){
|
||||
srcRect.x = c*map.tilesetCollection[0].tileWidth;
|
||||
@ -87,7 +87,7 @@ public:
|
||||
}
|
||||
}
|
||||
destRect.w = destRect.h = map.tileWidth * gScale;
|
||||
}
|
||||
*/}
|
||||
|
||||
void update() override
|
||||
{
|
||||
@ -104,7 +104,7 @@ public:
|
||||
{
|
||||
//iterate through rows and columns of the map to draw the tiles
|
||||
// First cycle through rows
|
||||
for (int r = 0;r<map.height;r++){
|
||||
/* for (int r = 0;r<map.height;r++){
|
||||
// Next cycle through each column or tile in that row:
|
||||
for (int c = 0;c<map.width;c++){
|
||||
int i = r*map.width+c;
|
||||
@ -118,7 +118,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define ASCII_ROW_COUNT 16
|
||||
|
||||
#include "Components.h"
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "../assetmgr/TextureManager.h"
|
||||
#include "../assetmgr/AssetManager.h"
|
||||
#include <stdio.h>
|
||||
|
@ -134,7 +134,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
|
||||
|
||||
// Trying out the halsafar/libtmx-parser
|
||||
tmxparser::TmxReturn error;
|
||||
/* tmxparser::TmxReturn error;
|
||||
tmxparser::TmxMap map;
|
||||
error = tmxparser::parseFromFile("assets/maps/testmapb64.tmx", &map, "assets/textures/tiles/");
|
||||
|
||||
@ -150,7 +150,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
} else {
|
||||
std::cout << "Encountered error loading map file: " << error << std::endl;
|
||||
}
|
||||
|
||||
*/
|
||||
// std::cout << "levelMap.w - camera.w: " << levelMap.w-camera.w << std::endl;
|
||||
|
||||
assets->AddTexture("player", "assets/textures/actors/firefighter.png");
|
||||
@ -237,7 +237,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
player.addComponent<KeyboardController>();
|
||||
player.addGroup(groupPlayers);
|
||||
|
||||
gameScene.addComponent<TileMapComponent>(map,gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
|
||||
gameScene.addComponent<TileMapComponent>(/*map,*/gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
|
||||
gameScene.addGroup(groupMap);
|
||||
|
||||
playerPosition = Vector2D().Zero();
|
||||
@ -254,7 +254,7 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
}
|
||||
|
||||
// ====== Setup groups
|
||||
auto& tiles(manager.getGroup(Game::groupMap));
|
||||
//auto& tiles(manager.getGroup(Game::groupMap));
|
||||
auto& players(manager.getGroup(Game::groupPlayers));
|
||||
auto& colliders(manager.getGroup(Game::groupColliders));
|
||||
auto& objects(manager.getGroup(Game::groupObjects));
|
||||
|
@ -7,16 +7,18 @@
|
||||
|
||||
#ifndef GAME_HPP_
|
||||
#define GAME_HPP_
|
||||
#include "../../libsdl2/include/SDL.h"
|
||||
#include "../../libsdl2_image/SDL_image.h"
|
||||
#include "../../libsdl2_mixer/SDL_mixer.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "Vector2D.h"
|
||||
#include "../assetmgr/AssetManager.h"
|
||||
#include "GameStateManager.h"
|
||||
#include "../../libtmx-parser/src/tmxparser.h"
|
||||
//#include "../../libtmx-parser/src/tmxparser.h"
|
||||
//#include "libtmx-parser/src/tmxparser.h"
|
||||
//#include <tmxparser.h>
|
||||
|
||||
class ColliderComponent;
|
||||
class AssetManager;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef SRC_UININESLICE_H_
|
||||
#define SRC_UININESLICE_H_
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include "string"
|
||||
#include "../game/Game.hpp"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define ASCII_COUNT 96
|
||||
#define ASCII_ROW_COUNT 16
|
||||
|
||||
#include "SDL2/SDL.h"
|
||||
#include <SDL2/SDL.h>
|
||||
#include <iostream>
|
||||
#include "../game/Game.hpp"
|
||||
#include "../assetmgr/TextureManager.h"
|
||||
|
Reference in New Issue
Block a user