removing unneeded code
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
#include "tile_editor.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace application {
|
|
||||||
namespace Editor {
|
|
||||||
|
|
||||||
void TileEditor::UpdateScreen() {}
|
|
||||||
} // namespace Editor
|
|
||||||
} // namespace application
|
|
||||||
} // namespace yaze
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef YAZE_APPLICATION_EDITOR_TILEEDITOR_H
|
|
||||||
#define YAZE_APPLICATION_EDITOR_TILEEDITOR_H
|
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace application {
|
|
||||||
namespace Editor {
|
|
||||||
class TileEditor {
|
|
||||||
public:
|
|
||||||
void UpdateScreen();
|
|
||||||
};
|
|
||||||
} // namespace Editor
|
|
||||||
} // namespace application
|
|
||||||
} // namespace yaze
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#include "scene.h"
|
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <tile.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "Graphics/tile.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace application {
|
|
||||||
namespace Graphics {
|
|
||||||
|
|
||||||
void Scene::buildSurface(const std::vector<tile8>& tiles, SNESPalette& mPalette,
|
|
||||||
const TilesPattern& tp) {
|
|
||||||
arrangedTiles = TilesPattern::transform(tp, tiles);
|
|
||||||
tilesPattern = tp;
|
|
||||||
allTiles = tiles;
|
|
||||||
|
|
||||||
for (unsigned int j = 0; j < arrangedTiles.size(); j++) {
|
|
||||||
for (unsigned int i = 0; i < arrangedTiles[0].size(); i++) {
|
|
||||||
tile8 tile = arrangedTiles[j][i];
|
|
||||||
// SDL_PIXELFORMAT_RGB888 ?
|
|
||||||
SDL_Surface* surface = SDL_CreateRGBSurfaceWithFormat(
|
|
||||||
0, 8, 8, SDL_BITSPERPIXEL(3), SDL_PIXELFORMAT_RGB444);
|
|
||||||
if (surface == nullptr) {
|
|
||||||
SDL_Log("SDL_CreateRGBSurfaceWithFormat() failed: %s", SDL_GetError());
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
SDL_PixelFormat* format = surface->format;
|
|
||||||
format->palette = mPalette.GetSDL_Palette();
|
|
||||||
char* ptr = (char*)surface->pixels;
|
|
||||||
|
|
||||||
for (int k = 0; k < 8; k++) {
|
|
||||||
for (int l = 0; l < 8; l++) {
|
|
||||||
ptr[k * 8 + l] = tile.data[k * 8 + l];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// SDL_Texture* texture =
|
|
||||||
// SDL_CreateTextureFromSurface(Core::renderer, surface);
|
|
||||||
// if (texture == nullptr) {
|
|
||||||
// std::cout << "Error: " << SDL_GetError() << std::endl;
|
|
||||||
// }
|
|
||||||
// imagesCache[tile.id] = texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene::updateScene() {
|
|
||||||
std::cout << "Update scene";
|
|
||||||
unsigned int itemCpt = 0;
|
|
||||||
for (unsigned int j = 0; j < arrangedTiles.size(); j++) {
|
|
||||||
for (unsigned int i = 0; i < arrangedTiles[0].size(); i++) {
|
|
||||||
tile8 tile = arrangedTiles[j][i];
|
|
||||||
// QPixmap m = imagesCache[tile.id];
|
|
||||||
// GraphicsTileItem *tileItem = (GraphicsTileItem *)items()[itemCpt];
|
|
||||||
// tileItem->image = m;
|
|
||||||
// tileItem->rawTile = tile;
|
|
||||||
// tileItem->setTileZoom(tilesZoom);
|
|
||||||
// tileItem->setPos(i * tileItem->boundingRect().width() + i,
|
|
||||||
// j * tileItem->boundingRect().width() + j);
|
|
||||||
itemCpt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene::setTilesZoom(unsigned int tileZoom) {
|
|
||||||
tilesZoom = tileZoom;
|
|
||||||
// if (!items().isEmpty()) updateScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Scene::setTilesPattern(TilesPattern tp) { tilesPattern = tp; }
|
|
||||||
|
|
||||||
} // namespace Graphics
|
|
||||||
} // namespace application
|
|
||||||
} // namespace yaze
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#ifndef YAZE_APPLICATION_GRAPHICS_SCENE_H
|
|
||||||
#define YAZE_APPLICATION_GRAPHICS_SCENE_H
|
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <tile.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "Graphics/tile.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace application {
|
|
||||||
namespace Graphics {
|
|
||||||
|
|
||||||
class Scene {
|
|
||||||
public:
|
|
||||||
Scene() = default;
|
|
||||||
void buildSurface(const std::vector<tile8>& tiles, SNESPalette& mPalette,
|
|
||||||
const TilesPattern& tp);
|
|
||||||
|
|
||||||
void updateScene();
|
|
||||||
void setTilesZoom(unsigned int tileZoom);
|
|
||||||
void setTilesPattern(TilesPattern tp);
|
|
||||||
|
|
||||||
std::unordered_map<unsigned int, SDL_Texture*> imagesCache;
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int tilesZoom;
|
|
||||||
TilesPattern tilesPattern;
|
|
||||||
std::vector<tile8> allTiles;
|
|
||||||
std::vector<std::vector<tile8>> arrangedTiles;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Graphics
|
|
||||||
} // namespace application
|
|
||||||
} // namespace yaze
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user