diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-12 10:29:53 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-12 10:29:53 +1100 |
commit | 79456640c548cff9125a5ba137538642e3c41141 (patch) | |
tree | fbfd474833b644b123e6f1d9dac78fedeceaf9bc /src/video/sdl.c | |
parent | 8968f471650d25c9df68347644e0e5c0ecdbda6e (diff) |
added cmd args; changed video implementation
Diffstat (limited to 'src/video/sdl.c')
-rw-r--r-- | src/video/sdl.c | 59 |
1 files changed, 41 insertions, 18 deletions
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<SDL2/SDL.h> +#include<SDL/SDL.h> #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() +{ + + +} |