case sensitive include fixes

This commit is contained in:
scawful
2022-06-13 13:50:21 -04:00
parent 935cc44ef8
commit 4d1b0dc103
8 changed files with 42 additions and 91 deletions

View File

@@ -1,6 +1,6 @@
#include "overworld.h" #include "overworld.h"
#include "graphics/tile.h" #include "Graphics/tile.h"
namespace yaze { namespace yaze {
namespace Application { namespace Application {
@@ -297,9 +297,7 @@ void Overworld::FetchLargeMaps() {
void Overworld::LoadOverworldMap() { void Overworld::LoadOverworldMap() {
overworldMapBitmap = new Bitmap(128, 128, overworldMapPointer); overworldMapBitmap = new Bitmap(128, 128, overworldMapPointer);
overworldMapBitmap->Create(&overworldMapTexture);
owactualMapBitmap = new Bitmap(512, 512, owactualMapPointer); owactualMapBitmap = new Bitmap(512, 512, owactualMapPointer);
owactualMapBitmap->Create(&owactualMapTexture);
// Mode 7 // Mode 7
char* ptr = overworldMapPointer; char* ptr = overworldMapPointer;

View File

@@ -6,10 +6,10 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "core/constants.h" #include "Core/constants.h"
#include "data/rom.h" #include "Data/rom.h"
#include "graphics/bitmap.h" #include "Graphics/bitmap.h"
#include "graphics/tile.h" #include "Graphics/tile.h"
#include "overworld_map.h" #include "overworld_map.h"
namespace yaze { namespace yaze {
@@ -28,11 +28,9 @@ class Overworld {
char* overworldMapPointer = new char[0x40000]; char* overworldMapPointer = new char[0x40000];
Graphics::Bitmap* overworldMapBitmap; Graphics::Bitmap* overworldMapBitmap;
GLuint overworldMapTexture;
char* owactualMapPointer = new char[0x40000]; char* owactualMapPointer = new char[0x40000];
Graphics::Bitmap* owactualMapBitmap; Graphics::Bitmap* owactualMapBitmap;
GLuint owactualMapTexture;
private: private:
Data::ROM rom_; Data::ROM rom_;

View File

@@ -1,11 +1,10 @@
#include <memory> #include <memory>
#include "data/rom.h" #include "Data/rom.h"
#include "Graphics/Bitmap.h" #include "Graphics/Bitmap.h"
#include "graphics/tile.h" #include "Graphics/tile.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
namespace yaze { namespace yaze {
namespace Application { namespace Application {
namespace Data { namespace Data {

View File

@@ -3,11 +3,11 @@
#include <imgui/imgui.h> #include <imgui/imgui.h>
#include "Graphics/Icons.h"
#include "Data/OW/Overworld.h" #include "Data/OW/Overworld.h"
#include "Graphics/Icons.h"
#include "Graphics/Palette.h" #include "Graphics/Palette.h"
#include "Graphics/Scene.h" #include "Graphics/Scene.h"
#include "graphics/tile.h" #include "Graphics/tile.h"
namespace yaze { namespace yaze {
namespace Application { namespace Application {
@@ -44,12 +44,9 @@ class OverworldEditor {
int allgfx_width = 0; int allgfx_width = 0;
int allgfx_height = 0; int allgfx_height = 0;
GLuint *allgfx_texture = nullptr;
byte *allGfx16Ptr = new byte[(128 * 7136) / 2]; byte *allGfx16Ptr = new byte[(128 * 7136) / 2];
GLuint *overworld_texture;
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit; ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders; ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders;
ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable | ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable |

View File

@@ -177,79 +177,41 @@ void CreateAllGfxData(char *romData, char *allgfx16Ptr) {
Bitmap::Bitmap(int width, int height, char *data) Bitmap::Bitmap(int width, int height, char *data)
: width_(width), height_(height), pixel_data_(data) {} : width_(width), height_(height), pixel_data_(data) {}
void Bitmap::Create(GLuint *out_texture) {
// // Read the pixel data from the ROM
// SDL_RWops * src = SDL_RWFromMem(pixel_data_, 0);
// // Create the surface from that RW stream
// SDL_Surface* surface = SDL_LoadBMP_RW(src, SDL_FALSE);
// GLenum mode = 0;
// Uint8 bpp = surface->format->charsPerPixel;
// Uint32 rm = surface->format->Rmask;
// if (bpp == 3 && rm == 0x000000ff) mode = GL_RGB;
// if (bpp == 3 && rm == 0x00ff0000) mode = GL_BGR;
// if (bpp == 4 && rm == 0x000000ff) mode = GL_RGBA;
// if (bpp == 4 && rm == 0xff000000) mode = GL_BGRA;
// GLsizei width = surface->w;
// GLsizei height = surface->h;
// GLenum format = mode;
// GLvoid* pixels = surface->pixels;
// Create a OpenGL texture identifier
GLuint image_texture;
glGenTextures(1, &image_texture);
glBindTexture(GL_TEXTURE_2D, image_texture);
// Setup filtering parameters for display
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// Upload pixels into texture
#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width_, height_, 0, GL_RGBA,
GL_UNSIGNED_BYTE, pixel_data_);
*out_texture = image_texture;
}
int Bitmap::GetWidth() { return width_; } int Bitmap::GetWidth() { return width_; }
int Bitmap::GetHeight() { return height_; } int Bitmap::GetHeight() { return height_; }
// Simple helper function to load an image into a OpenGL texture with common // Simple helper function to load an image into a OpenGL texture with common
// settings // settings
bool Bitmap::LoadBitmapFromROM(unsigned char *texture_data, GLuint *out_texture, bool Bitmap::LoadBitmapFromROM(unsigned char *texture_data,
int *out_width, int *out_height) { int *out_width, int *out_height) {
// Load from file // // Load from file
int image_width = 0; // int image_width = 0;
int image_height = 0; // int image_height = 0;
if (texture_data == NULL) return false; // if (texture_data == NULL) return false;
// Create a OpenGL texture identifier // // Create a OpenGL texture identifier
GLuint image_texture; // GLuint image_texture;
glGenTextures(1, &image_texture); // glGenTextures(1, &image_texture);
glBindTexture(GL_TEXTURE_2D, image_texture); // glBindTexture(GL_TEXTURE_2D, image_texture);
// Setup filtering parameters for display // // Setup filtering parameters for display
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_CLAMP_TO_EDGE); // This is required on WebGL for non // GL_CLAMP_TO_EDGE); // This is required on WebGL for non
// power-of-two textures // // power-of-two textures
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Same // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Same
// Upload pixels into texture // // Upload pixels into texture
#if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__) // #if defined(GL_UNPACK_ROW_LENGTH) && !defined(__EMSCRIPTEN__)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif // #endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width, image_height, 0, GL_RGBA, // glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width, image_height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, texture_data); // GL_UNSIGNED_BYTE, texture_data);
*out_texture = image_texture; // *out_texture = image_texture;
*out_width = image_width; // *out_width = image_width;
*out_height = image_height; // *out_height = image_height;
return true; return true;
} }

View File

@@ -2,7 +2,6 @@
#define YAZE_APPLICATION_UTILS_BITMAP_H #define YAZE_APPLICATION_UTILS_BITMAP_H
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL_opengl.h>
#include <memory> #include <memory>
@@ -17,11 +16,10 @@ class Bitmap {
Bitmap() = default; Bitmap() = default;
Bitmap(int width, int height, char *data); Bitmap(int width, int height, char *data);
void Create(GLuint *out_texture);
int GetWidth(); int GetWidth();
int GetHeight(); int GetHeight();
bool LoadBitmapFromROM(unsigned char *texture_data, GLuint *out_texture, bool LoadBitmapFromROM(unsigned char *texture_data,
int *out_width, int *out_height); int *out_width, int *out_height);
private: private:

View File

@@ -7,8 +7,8 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "Core/Renderer.h" #include "Core/renderer.h"
#include "graphics/tile.h" #include "Graphics/tile.h"
namespace yaze { namespace yaze {
namespace Application { namespace Application {
@@ -20,21 +20,20 @@ class Scene {
void buildScene(const std::vector<tile8>& tiles, const SNESPalette mPalette, void buildScene(const std::vector<tile8>& tiles, const SNESPalette mPalette,
const TilesPattern& tp); const TilesPattern& tp);
void buildSurface(const std::vector<tile8>& tiles, void buildSurface(const std::vector<tile8>& tiles, SNESPalette& mPalette,
SNESPalette& mPalette, const TilesPattern& tp); const TilesPattern& tp);
void updateScene(); void updateScene();
void setTilesZoom(unsigned int tileZoom); void setTilesZoom(unsigned int tileZoom);
void setTilesPattern(TilesPattern tp); void setTilesPattern(TilesPattern tp);
std::unordered_map<unsigned int, SDL_Texture*> imagesCache; std::unordered_map<unsigned int, SDL_Texture*> imagesCache;
private: private:
unsigned int tilesZoom; unsigned int tilesZoom;
TilesPattern tilesPattern; TilesPattern tilesPattern;
std::vector<tile8> allTiles; std::vector<tile8> allTiles;
std::vector<std::vector<tile8> > arrangedTiles; std::vector<std::vector<tile8>> arrangedTiles;
}; };
} // namespace Graphics } // namespace Graphics

View File

@@ -1,5 +1,5 @@
#ifndef YAZE_APPLICATION_CORE_STYLE_H #ifndef YAZE_APPLICATION_CORE_STYLE_H
#define YAZE_APPLCIATION_CORE_STYLE_H #define YAZE_APPLICATION_CORE_STYLE_H
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "imgui/imgui_internal.h" #include "imgui/imgui_internal.h"