This commit is contained in:
2017-02-06 12:14:05 +01:00
parent 209c869eeb
commit 19a2260644
9 changed files with 60 additions and 43 deletions

21
vdp.cpp
View File

@@ -3,6 +3,7 @@
//#include "stb_image.h"
#include <string.h>
#include "font.h"
#include "error.h"
#define VDP_CMD_LOCATE 0
#define VDP_CMD_PRINT 1
@@ -27,8 +28,6 @@ static SDL_Renderer* sdlRenderer = NULL;
static SDL_Texture* sdlTexture = NULL;
static SDL_Rect src, dst;
static bool fullscreen = false;
static const Uint8* keys = nullptr;
static Uint8 just_pressed = SDL_SCANCODE_UNKNOWN;
static t_sprite sprites[32];
@@ -63,6 +62,8 @@ static Uint8 palette[16][4] = {
{ 0, 0, 0, 255 },
};
void vdp_flip();
void vdp_init() {
SDL_Init(SDL_INIT_EVERYTHING);
sdlWindow = SDL_CreateWindow("PaCo", 160, SDL_WINDOWPOS_UNDEFINED, 608, 480, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_SHOWN);
@@ -72,13 +73,19 @@ void vdp_init() {
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STATIC, 128, 128);
SDL_ShowCursor(fullscreen ? 0 : 1);
for (int i = 0; i < 16 * 12; i++) screen_map[i] = 32;
src.x = src.y = 0;
dst.x = dst.y = 12;
src.w = dst.w = 128;
src.h = dst.h = 96;
for (int i = 0; i < 16 * 12; i++) screen_map[i] = 32;
for (int i = 0; i < 16 * 12; i++) screen_color[i] = color;
src.x = src.y = 0;
dst.x = dst.y = 12;
src.w = dst.w = 128;
src.h = dst.h = 96;
if (error_raised()) {
error_print(screen_map);
border = 0;
vdp_flip();
}
}
void vdp_quit() {