From 79456640c548cff9125a5ba137538642e3c41141 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Tue, 12 Dec 2023 10:29:53 +1100 Subject: added cmd args; changed video implementation --- src/video/sdl.c | 59 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 18 deletions(-) (limited to 'src/video/sdl.c') diff --git a/src/video/sdl.c b/src/video/sdl.c index 7161a08..a0cb0af 100644 --- a/src/video/sdl.c +++ b/src/video/sdl.c @@ -2,8 +2,7 @@ // Implements interface.h // Emulates the graphics of the Apple I computer with SDL. -#include"interface.h" -#include +#include #define SCALE 2 @@ -15,24 +14,39 @@ #define MIN_WIDTH (40 * CHR_WIDTH) + 39*WIDTH_SPACE #define MIN_HEIGHT (24 * CHR_HEIGHT) -int TerminalInit(){ + + +SDL_Surface* MainWindow; +SDL_Surface* Font; + +void PrintInfo_SDL() +{ + + +} + + +int DisplayInit_SDL() +{ // INITIALIZATION SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO); - SDL_Window* window = SDL_CreateWindow( - "Apple C", + MainWindow = SDL_SetVideoMode(MIN_WIDTH*SCALE, MIN_HEIGHT*SCALE, 8, NULL); + + + /*= SDL_CreateWindow( + "apple-c", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 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_FreeSurface(font_surface); + );*/ + Font = SDL_LoadBMP("font.bmp"); + + SDL_Surface* font_surface = SDL_LoadBMP("font.bmp"); + SDL_Rect character = { .x = 0, .y = 0, @@ -47,13 +61,22 @@ int TerminalInit(){ .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 DisplayClose_SDL() +{ + SDL_FreeSurface(MainWindow); + SDL_FreeSurface(Font); } -void TerminalClose() { - SDL_Quit(); -} \ No newline at end of file + +void DisplayInput_SDL() +{ + + +} -- cgit v1.2.3