summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2019-11-02 23:27:42 -0400
committerAndrew Opalach <andrew@akon.city> 2019-11-02 23:27:42 -0400
commit36d4834de420d156aa669bd1b879941a55b8f1e6 (patch)
tree6932f734e969d5bd611c9d0d810d2b2594d089ae
parentf46c764dc09c710867580f3ca3906a2af83dc886 (diff)
downloadcetris-36d4834de420d156aa669bd1b879941a55b8f1e6.tar.gz
cetris-36d4834de420d156aa669bd1b879941a55b8f1e6.tar.bz2
cetris-36d4834de420d156aa669bd1b879941a55b8f1e6.zip
resolution scale
-rw-r--r--frontends/gl/main.c16
-rw-r--r--frontends/gl/skin.c2
-rw-r--r--frontends/gl/ui.c15
3 files changed, 21 insertions, 12 deletions
diff --git a/frontends/gl/main.c b/frontends/gl/main.c
index a493889..8eca628 100644
--- a/frontends/gl/main.c
+++ b/frontends/gl/main.c
@@ -21,8 +21,9 @@
static const int FRAME_RATE = 144;
static const int SCREEN_FULLSCREEN = 0;
-static const int SCREEN_WIDTH = 900;
-static const int SCREEN_HEIGHT = 720;
+static const int RES_SCALE = 2;
+static const int SCREEN_WIDTH = 900 * RES_SCALE;
+static const int SCREEN_HEIGHT = 720 * RES_SCALE;
static SDL_Window *window = NULL;
static SDL_GLContext maincontext;
@@ -186,7 +187,7 @@ int main(void) {
ui.keys = default_keys;
- glViewport(0, 0, 900, 720);
+ glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -204,9 +205,12 @@ int main(void) {
init_game(&ui.board.game);
cetris_start_game(&ui.board.game);
- load_tetris_board(&ui, &ui.board, 325.0f, 110.0f, 250.0f, 500.0f);
- load_piece_queue(&ui, &ui.board, 610.0f, 100.0f, 100.0f, 400.0f);
- load_held_piece(&ui, &ui.board, 242.0f, 110.0f, 88.0f, 88.0f);
+ load_tetris_board(&ui, &ui.board, 325.0f * RES_SCALE,
+ 110.0f * RES_SCALE, 250.0f * RES_SCALE, 500.0f * RES_SCALE);
+ load_piece_queue(&ui, &ui.board, 610.0f * RES_SCALE,
+ 100.0f * RES_SCALE, 100.0f * RES_SCALE, 400.0f * RES_SCALE);
+ load_held_piece(&ui, &ui.board, 242.0f * RES_SCALE,
+ 110.0f * RES_SCALE, 88.0f * RES_SCALE, 88.0f * RES_SCALE);
start_event_thread(&ui);
diff --git a/frontends/gl/skin.c b/frontends/gl/skin.c
index 7dad4ee..6a1f123 100644
--- a/frontends/gl/skin.c
+++ b/frontends/gl/skin.c
@@ -52,8 +52,10 @@ void load_skin(char* name, cetris_skin_t* skin) {
load_multiple_audio("erase", dir_name,
&skin->clear_sound_count, &skin->clear_sound);
+ /*
load_multiple_audio("tspin", dir_name,
&skin->clear_sound_count, &skin->clear_sound);
+ */
load_multiple_audio("combo", dir_name,
&skin->combo_sound_count, &skin->combo_sound);
diff --git a/frontends/gl/ui.c b/frontends/gl/ui.c
index d2747e5..0dadf4e 100644
--- a/frontends/gl/ui.c
+++ b/frontends/gl/ui.c
@@ -4,6 +4,8 @@
#include "ui.h"
#include "drawable.h"
+static const int RES_SCALE = 2;
+
void load_tetris_board(cetris_ui *ui, tetris_board_t *board, GLfloat x, GLfloat y, GLfloat w, GLfloat h) {
board->block_width = w / (GLfloat)board->game.config.board_x;
board->block_height = h / board->game.config.board_visible;
@@ -12,12 +14,13 @@ void load_tetris_board(cetris_ui *ui, tetris_board_t *board, GLfloat x, GLfloat
board->y_offset = y;
board->block_offset = (board->game.config.board_y - board->game.config.board_visible);
- update_rect(&board->skin.playboard, board->x_offset, board->y_offset - 10,
+ update_rect(&board->skin.playboard, board->x_offset, board->y_offset - 10 * RES_SCALE,
board->game.config.board_x * board->block_width,
- (board->game.config.board_visible * board->block_height) + 10,
+ (board->game.config.board_visible * board->block_height) + 10 * RES_SCALE,
ui->window_width, ui->window_height);
- update_rect(&board->skin.border, board->x_offset - 110, board->y_offset - 45, 380, 600,
+ update_rect(&board->skin.border, board->x_offset - (110 * RES_SCALE),
+ board->y_offset - (45 * RES_SCALE), 380 * RES_SCALE, 600 * RES_SCALE,
ui->window_width, ui->window_height);
}
@@ -64,8 +67,8 @@ void draw_tetris_board(cetris_ui *ui) {
GLfloat y_pos = (ui->board.y_offset - ui->board.block_height) + (y * ui->board.block_height);
if (y == 0) {
ui->board.skin.overlay.vertices[4] = ui->board.skin.overlay.vertices[9] = 0.6f;
- height = 10;
- y_pos += 15;
+ height = 10 * RES_SCALE;
+ y_pos += 15 * RES_SCALE;
}
set_shine(&ui->board.skin.overlay, ui->board.skin.overlay_shine);
update_rect(&ui->board.skin.overlay, ui->board.x_offset,
@@ -228,4 +231,4 @@ void draw_piece_queue(cetris_ui *ui) {
}
}
glBindTexture(GL_TEXTURE_2D, 0);
-} \ No newline at end of file
+}