From ce8a093ece30d3ab608a52b0247ad7a195cc0cc8 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Wed, 13 Mar 2019 19:57:55 +0200 Subject: [PATCH] display next block --- src/gamescr.c | 13 +++++++++++-- src/opengl.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/gamescr.c b/src/gamescr.c index d2e0219..fde286d 100644 --- a/src/gamescr.c +++ b/src/gamescr.c @@ -302,7 +302,9 @@ static void update(float dtsec) static void draw(void) { - const float lpos[] = {-1, 1, 6, 1}; + static const int nextblk_pos[] = {0, 0}; + static const float lpos[] = {-1, 1, 6, 1}; + float t; glTranslatef(0, 0, -cam_dist); glRotatef(cam_phi, 1, 0, 0); @@ -328,8 +330,15 @@ static void draw(void) if(cur_block >= 0) { draw_block(cur_block, pos, cur_rot); } - glPopMatrix(); + + t = (float)time_msec / 1000.0f; + glTranslatef(-PF_COLS / 2 + 0.5 + PF_COLS + 3, PF_ROWS / 2 - 0.5, 0); + glTranslatef(1.5, -1, 0); + glRotatef(cos(t) * 8.0f, 1, 0, 0); + glRotatef(sin(t * 1.2f) * 10.0f, 0, 1, 0); + glTranslatef(-1.5, 1, 0); + draw_block(next_block, nextblk_pos, 0); } static const float blkspec[] = {0.85, 0.85, 0.85, 1}; diff --git a/src/opengl.c b/src/opengl.c index 281ec44..804bb9f 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -67,7 +67,7 @@ static void GLAPIENTRY gldebug_logger(GLenum src, GLenum type, GLuint id, GLenum case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: case GL_DEBUG_TYPE_PORTABILITY: case GL_DEBUG_TYPE_PERFORMANCE: - warning_log(fmt, gldebug_srcstr(src), gldebug_typestr(type), msg); + debug_log(fmt, gldebug_srcstr(src), gldebug_typestr(type), msg); break; default: -- 1.7.10.4