From 2ded6baaab3946e461a7cf0b39618b31e5806c89 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Tue, 28 Nov 2023 02:51:33 +1100 Subject: days end --- src/video/sdl.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/video/sdl.c') diff --git a/src/video/sdl.c b/src/video/sdl.c index 811b0d3..7161a08 100644 --- a/src/video/sdl.c +++ b/src/video/sdl.c @@ -5,34 +5,35 @@ #include"interface.h" #include -#define SCALE 2 +#define SCALE 2 -#define CHR_WIDTH 5 -#define CHR_HEIGHT 8 +#define CHR_WIDTH 5 +#define CHR_HEIGHT 8 #define WIDTH_SPACE 1 * SCALE -#define MIN_WIDTH (40 * CHR_WIDTH) + 39*WIDTH_SPACE -#define MIN_HEIGHT (24 * CHR_HEIGHT) +#define MIN_WIDTH (40 * CHR_WIDTH) + 39*WIDTH_SPACE +#define MIN_HEIGHT (24 * CHR_HEIGHT) -int VideoInit(){ +int TerminalInit(){ // INITIALIZATION SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO); - SDL_Window* window = SDL_CreateWindow( + + SDL_Window* window = SDL_CreateWindow( "Apple C", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - MIN_WIDTH * SCALE, - MIN_HEIGHT * SCALE, + MIN_WIDTH * SCALE, + MIN_HEIGHT * SCALE, SDL_WINDOW_SHOWN ); - SDL_Renderer* render = SDL_CreateRenderer(window, -1, 0); - SDL_Surface* font_surface = SDL_LoadBMP("font.bmp"); - SDL_Texture* font_texture = SDL_CreateTextureFromSurface(render, font_surface); + SDL_Renderer* render = SDL_CreateRenderer(window, -1, 0); + SDL_Surface* font_surface = SDL_LoadBMP("font.bmp"); + SDL_Texture* font_texture = SDL_CreateTextureFromSurface(render, font_surface); SDL_FreeSurface(font_surface); - SDL_Rect character = { + SDL_Rect character = { .x = 0, .y = 0, .w = CHR_WIDTH, @@ -46,15 +47,13 @@ int VideoInit(){ .h = CHR_HEIGHT * SCALE }; - SDL_SetRenderDrawColor (render, 0, 0, 0, 255); - SDL_RenderClear (render); - SDL_RenderCopy (render, font_texture, &character, &draw_character); - SDL_RenderPresent (render); + SDL_SetRenderDrawColor (render, 0, 0, 0, 255); + SDL_RenderClear (render); + SDL_RenderCopy (render, font_texture, &character, &draw_character); + SDL_RenderPresent (render); } -void VideoClose() { - - +void TerminalClose() { SDL_Quit(); } \ No newline at end of file -- cgit v1.2.3