summaryrefslogtreecommitdiff
path: root/src/video/sdl.c
blob: a0cb0af5e2704cd5588f8dbe6356610a3d1c2a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// sdl.c
// Implements interface.h
// Emulates the graphics of the Apple I computer with SDL.

#include<SDL/SDL.h>

#define	SCALE 2

#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)



SDL_Surface* MainWindow;
SDL_Surface* Font;

void PrintInfo_SDL()
{


}


int DisplayInit_SDL()
{
	// INITIALIZATION
	SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO);
	
	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
		);*/

	Font = SDL_LoadBMP("font.bmp");
	
	SDL_Surface* font_surface = SDL_LoadBMP("font.bmp");
	
	SDL_Rect character = {
		.x = 0,
		.y = 0,
		.w = CHR_WIDTH,
		.h = CHR_HEIGHT
	};

	SDL_Rect draw_character = {
		.x = 0,
		.y = 0,
		.w = CHR_WIDTH	* SCALE,
		.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);

}

void DisplayClose_SDL()
{
	SDL_FreeSurface(MainWindow);
	SDL_FreeSurface(Font);
}


void DisplayInput_SDL()
{


}