|
@@ -23,8 +23,8 @@ SDL_Window *window = NULL;
|
|
|
SDL_Renderer *renderer = NULL;
|
|
|
uint32_t *frameBuffer = NULL;
|
|
|
SDL_Texture *frameBufferTexture = NULL;
|
|
|
-int32_t windowWidth = 800;
|
|
|
-int32_t windowHeight = 600;
|
|
|
+int32_t windowWidth = 1024;
|
|
|
+int32_t windowHeight = 768;
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
* Functions
|
|
@@ -102,7 +102,7 @@ void renderFrameBuffer()
|
|
|
SDL_RenderCopy(renderer, frameBufferTexture, NULL, NULL);
|
|
|
}
|
|
|
|
|
|
-void drawPixel(uint32_t x, uint32_t y, uint32_t colour)
|
|
|
+void drawPixel(int32_t x, int32_t y, uint32_t colour)
|
|
|
{
|
|
|
if ((x >= 0) && (x < windowWidth) && (y >= 0) && (y < windowHeight))
|
|
|
{
|
|
@@ -112,8 +112,9 @@ void drawPixel(uint32_t x, uint32_t y, uint32_t colour)
|
|
|
|
|
|
void drawVLine(int32_t x, int32_t y0, int32_t y1, uint32_t colour)
|
|
|
{
|
|
|
- uint32_t i;
|
|
|
- if (y0 > y1) { i = y1; y1 = y0; y0 = i; }
|
|
|
+ int32_t i;
|
|
|
+ if (y0 > y1) {
|
|
|
+ intSwap(&y0, &y1); }
|
|
|
|
|
|
if ( ((x < 0) || (x > windowWidth)) ||
|
|
|
((y0 < 0) && (y1 < 0)) ||
|
|
@@ -135,8 +136,9 @@ void drawVLine(int32_t x, int32_t y0, int32_t y1, uint32_t colour)
|
|
|
|
|
|
void drawHLine(int32_t x0, int32_t y, int32_t x1, uint32_t colour)
|
|
|
{
|
|
|
- uint32_t i;
|
|
|
- if (x0 > x1) { i = x1; x1 = x0; x0 = i; }
|
|
|
+ int32_t i;
|
|
|
+ if (x0 > x1) {
|
|
|
+ intSwap(&x0, &x1); }
|
|
|
|
|
|
if ( ((y < 0) || (y > windowHeight)) ||
|
|
|
((x0 < 0) && (x1 < 0)) ||
|
|
@@ -158,7 +160,7 @@ void drawHLine(int32_t x0, int32_t y, int32_t x1, uint32_t colour)
|
|
|
|
|
|
void clearFrameBuffer(int32_t colour)
|
|
|
{
|
|
|
- uint32_t x, y;
|
|
|
+ int32_t x, y;
|
|
|
for (y = 0 ; y < windowHeight ; y++)
|
|
|
{
|
|
|
for (x = 0 ; x < windowWidth ; x++)
|
|
@@ -183,9 +185,9 @@ void drawGrid(int spacing, uint32_t colour)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void drawRectangle(int32_t x, int32_t y, int32_t w, uint32_t h, uint32_t colour)
|
|
|
+void drawRectangle(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t colour)
|
|
|
{
|
|
|
- uint32_t j;
|
|
|
+ int32_t j;
|
|
|
|
|
|
for (j = 0 ; j < h ; j++)
|
|
|
{
|