Reintroduce const correctness
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Hall
|
|||||||
/// <param name="width">The width of the excerpt</param>
|
/// <param name="width">The width of the excerpt</param>
|
||||||
/// <param name="height">The height of the excerpt</param>
|
/// <param name="height">The height of the excerpt</param>
|
||||||
/// <param name="dataWidth">The width of the image (NOT EXCERPT)</param>
|
/// <param name="dataWidth">The width of the image (NOT EXCERPT)</param>
|
||||||
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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clears the whole screen with the given color
|
/// Clears the whole screen with the given color
|
||||||
@@ -24,7 +24,7 @@ namespace Hall
|
|||||||
/// <param name="color">The format is R5G5B5A1, with the alpha bit being lsb</param>
|
/// <param name="color">The format is R5G5B5A1, with the alpha bit being lsb</param>
|
||||||
void Clear(unsigned short color);
|
void Clear(unsigned short color);
|
||||||
|
|
||||||
void SetData(unsigned short* data);
|
void SetData(const unsigned short* data);
|
||||||
void SetXOffset(unsigned short xOffset);
|
void SetXOffset(unsigned short xOffset);
|
||||||
void SetYOffset(unsigned short yOffset);
|
void SetYOffset(unsigned short yOffset);
|
||||||
void SetImageWidth(unsigned short imageWidth);
|
void SetImageWidth(unsigned short imageWidth);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <Hall/Video.h>
|
#include <Hall/Video.h>
|
||||||
|
|
||||||
volatile char* GPU_START = (char*)0x02000000;
|
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_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_Y_OFFSET = (volatile unsigned short*)(GPU_START + 8);
|
||||||
volatile unsigned short* GPU_IMAGE_WIDTH = (volatile unsigned short*)(GPU_START + 12);
|
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);
|
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_START = data;
|
||||||
*GPU_IMAGE_X_OFFSET = xOffset;
|
*GPU_IMAGE_X_OFFSET = xOffset;
|
||||||
@@ -39,7 +39,7 @@ void Hall::Clear(unsigned short color)
|
|||||||
*GPU_COMMAND_CLEAR = true;
|
*GPU_COMMAND_CLEAR = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hall::SetData(unsigned short* data)
|
void Hall::SetData(const unsigned short* data)
|
||||||
{
|
{
|
||||||
*GPU_IMAGE_START = data;
|
*GPU_IMAGE_START = data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ void RenderModule::RenderSprites(entt::registry& registry)
|
|||||||
uint8_t column = sprite.texture_atlas_index % layout.columns;
|
uint8_t column = sprite.texture_atlas_index % layout.columns;
|
||||||
// Problemchen: Wir können die Sprites nicht strecken... hat keiner Interpolation
|
// Problemchen: Wir können die Sprites nicht strecken... hat keiner Interpolation
|
||||||
// implementiert?
|
// implementiert?
|
||||||
Hall::Draw(reinterpret_cast<unsigned short*>(
|
Hall::Draw(reinterpret_cast<unsigned short const*>(sprite.texture->data), // Das ist 100% UB
|
||||||
const_cast<uint8_t*>(sprite.texture->data)), // Das ist 100% UB
|
|
||||||
column * layout.width,
|
column * layout.width,
|
||||||
row * layout.height,
|
row * layout.height,
|
||||||
pos.x,
|
pos.x,
|
||||||
|
|||||||
Reference in New Issue
Block a user