v0.6.0
[FEAT] New mode(3) with 32x24 characters
This commit is contained in:
32
ascii.cpp
32
ascii.cpp
@@ -21,6 +21,10 @@ uint8_t *char_screen = NULL;
|
||||
uint8_t *color_screen = NULL;
|
||||
uint8_t screen_width = 40;
|
||||
uint8_t screen_height = 30;
|
||||
int v_screen_w = 640;
|
||||
int v_screen_h = 480;
|
||||
uint8_t hborder = 40;
|
||||
uint8_t vborder = 40;
|
||||
uint8_t current_color = 0x1e;
|
||||
uint8_t current_border = 0;
|
||||
uint8_t current_mode = 1;
|
||||
@@ -65,6 +69,8 @@ const char* get_filename() {
|
||||
void reinit() {
|
||||
if (mini_bak != NULL) SDL_DestroyTexture(mini_bak);
|
||||
counter=0;
|
||||
hborder = vborder = 40;
|
||||
v_screen_w = 640; v_screen_h = 480;
|
||||
switch (current_mode) {
|
||||
case 0:
|
||||
screen_width = 80;
|
||||
@@ -102,17 +108,21 @@ void reinit() {
|
||||
//SDL_RenderSetLogicalSize(mini_ren, 160, 120);
|
||||
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 160, 120);
|
||||
break;
|
||||
case 3: // SUPERSECRET MODE FOR THE EDITOR!!!
|
||||
screen_width = 80;
|
||||
screen_height = 30;
|
||||
current_color = 0x1f;
|
||||
current_border = 9;
|
||||
case 3:
|
||||
hborder = 104;
|
||||
vborder = 88;
|
||||
v_screen_w = 512;
|
||||
v_screen_h = 384;
|
||||
screen_width = 32;
|
||||
screen_height = 24;
|
||||
current_color = 0x07;
|
||||
current_border = 0;
|
||||
cursor_x = 0;
|
||||
cursor_y = 0;
|
||||
char_screen = &mem[0];
|
||||
color_screen = &mem[0x1200];
|
||||
color_screen = &mem[1200];
|
||||
//SDL_RenderSetLogicalSize(mini_ren, 640, 480);
|
||||
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 640, 240);
|
||||
mini_bak = SDL_CreateTexture(mini_ren, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 256, 192);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -233,9 +243,9 @@ int main(int argc,char*argv[]) {
|
||||
keys = SDL_GetKeyboardState(NULL);
|
||||
int mx, my;
|
||||
mouse_buttons = SDL_GetMouseState(&mx, &my);
|
||||
if (mx>=40 && my>=40 && mx<680 && my<520) {
|
||||
mouse_x = (mx-40) / (640/screen_width);
|
||||
mouse_y = (my-40) / (480/screen_height);
|
||||
if (mx>=hborder && my>=vborder && mx<(v_screen_w+hborder) && my<(v_screen_h+vborder)) {
|
||||
mouse_x = (mx-hborder) / (v_screen_w/screen_width);
|
||||
mouse_y = (my-vborder) / (v_screen_h/screen_height);
|
||||
}
|
||||
|
||||
if (lua_is_playing()) {
|
||||
@@ -303,7 +313,7 @@ int main(int argc,char*argv[]) {
|
||||
SDL_SetRenderDrawColor(mini_ren, (palette[current_border] >> 16)&0xff, (palette[current_border] >> 8)&0xff, palette[current_border]&0xff, 0);
|
||||
//SDL_SetRenderDrawColor(mini_ren, 255, 0, 0, 0);
|
||||
SDL_RenderClear(mini_ren);
|
||||
SDL_Rect rect = {40, 40, 640, 480};
|
||||
SDL_Rect rect = {hborder, vborder, v_screen_w, v_screen_h};
|
||||
SDL_RenderCopy(mini_ren, mini_bak, NULL, &rect);
|
||||
//SDL_RenderCopy(mini_ren, mini_bak, NULL, NULL);
|
||||
SDL_RenderPresent(mini_ren);
|
||||
|
||||
Reference in New Issue
Block a user