Renamed project to raffbreakout and used macro for colours

This commit is contained in:
Mpho raf
2024-12-11 12:32:14 +02:00
parent 11c7d1bf8e
commit d0add8e9a4
2 changed files with 10 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(SDLWindow C)
project(rafbreakout C)
# Set C99 standard
set(CMAKE_C_STANDARD 99)

View File

@@ -2,6 +2,12 @@
#include <stdbool.h>
#include <stdio.h>
#define hexcolour(colour) \
(colour >> (0*8))& 0xFF, \
(colour >> (1*8))& 0xFF, \
(colour >> (2*8))& 0xFF, \
(colour >> (3*8))& 0xFF \
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
@@ -19,7 +25,7 @@ int main(int argc, char* argv[]) {
// Create window
window = SDL_CreateWindow(
"SDL Window",
"raff-Breakout",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
WINDOW_WIDTH,
@@ -41,7 +47,7 @@ int main(int argc, char* argv[]) {
return 1;
}
// Main loop
// Main event loop
while (running) {
// Handle events
while (SDL_PollEvent(&event)) {
@@ -51,7 +57,7 @@ int main(int argc, char* argv[]) {
}
// Clear screen
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_SetRenderDrawColor(renderer, hexcolour(0xFF0000FF));
SDL_RenderClear(renderer);
// Present renderer