diff --git a/lib/Hall/include/Hall/Video.h b/lib/Hall/include/Hall/Video.h index 0ce4634..4cfc3ca 100644 --- a/lib/Hall/include/Hall/Video.h +++ b/lib/Hall/include/Hall/Video.h @@ -16,7 +16,7 @@ namespace Hall /// The width of the excerpt /// The height of the excerpt /// The width of the image (NOT EXCERPT) - void Draw(unsigned short* data, unsigned short xOffset, unsigned short yOffset, unsigned short screenX, unsigned short screenY, unsigned short width, unsigned short height, unsigned short dataWidth); + void Draw(const unsigned short* data, unsigned short xOffset, unsigned short yOffset, unsigned short screenX, unsigned short screenY, unsigned short width, unsigned short height, unsigned short dataWidth); /// /// Clears the whole screen with the given color @@ -24,7 +24,7 @@ namespace Hall /// The format is R5G5B5A1, with the alpha bit being lsb void Clear(unsigned short color); - void SetData(unsigned short* data); + void SetData(const unsigned short* data); void SetXOffset(unsigned short xOffset); void SetYOffset(unsigned short yOffset); void SetImageWidth(unsigned short imageWidth); diff --git a/lib/Hall/source/Video.cpp b/lib/Hall/source/Video.cpp index 532d855..1fe7b22 100644 --- a/lib/Hall/source/Video.cpp +++ b/lib/Hall/source/Video.cpp @@ -1,7 +1,7 @@ #include volatile char* GPU_START = (char*)0x02000000; -volatile unsigned short** GPU_IMAGE_START = (volatile unsigned short**)(GPU_START + 0); +volatile unsigned short const** GPU_IMAGE_START = (volatile unsigned short const**)(GPU_START + 0); volatile unsigned short* GPU_IMAGE_X_OFFSET = (volatile unsigned short*)(GPU_START + 4); volatile unsigned short* GPU_IMAGE_Y_OFFSET = (volatile unsigned short*)(GPU_START + 8); volatile unsigned short* GPU_IMAGE_WIDTH = (volatile unsigned short*)(GPU_START + 12); @@ -19,7 +19,7 @@ volatile bool* GPU_COMMAND_SWAP_BUFFERS = (volatile bool*)(GPU_START + 56); volatile bool* VSYNC_BUFFER_SWAP = (volatile bool*)(GPU_START + 60); -void Hall::Draw(unsigned short* data, unsigned short xOffset, unsigned short yOffset, unsigned short screenX, unsigned short screenY, unsigned short width, unsigned short height, unsigned short dataWidth) +void Hall::Draw(const unsigned short* data, unsigned short xOffset, unsigned short yOffset, unsigned short screenX, unsigned short screenY, unsigned short width, unsigned short height, unsigned short dataWidth) { *GPU_IMAGE_START = data; *GPU_IMAGE_X_OFFSET = xOffset; @@ -39,7 +39,7 @@ void Hall::Clear(unsigned short color) *GPU_COMMAND_CLEAR = true; } -void Hall::SetData(unsigned short* data) +void Hall::SetData(const unsigned short* data) { *GPU_IMAGE_START = data; } diff --git a/src/render.cpp b/src/render.cpp index 89405ed..8dc8928 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -28,8 +28,7 @@ void RenderModule::RenderSprites(entt::registry& registry) uint8_t column = sprite.texture_atlas_index % layout.columns; // Problemchen: Wir können die Sprites nicht strecken... hat keiner Interpolation // implementiert? - Hall::Draw(reinterpret_cast( - const_cast(sprite.texture->data)), // Das ist 100% UB + Hall::Draw(reinterpret_cast(sprite.texture->data), // Das ist 100% UB column * layout.width, row * layout.height, pos.x,