|
|
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
|
|
|
|
#include "draw.h" |
|
|
|
|
#include "environment.h" |
|
|
|
|
#include "game.h" |
|
|
|
|
#include "types.h" |
|
|
|
|
#include <SDL2/SDL_mutex.h> |
|
|
|
@ -652,6 +653,97 @@ void draw_level_time(SDL_Renderer *ren, const struct environment * e) {
@@ -652,6 +653,97 @@ void draw_level_time(SDL_Renderer *ren, const struct environment * e) {
|
|
|
|
|
position.y += 40; |
|
|
|
|
draw_text_default(ren, position, colour, time_string); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
void draw_mute_button(SDL_Renderer *ren) { |
|
|
|
|
|
|
|
|
|
struct colour c = get_scene_watch()->colours.fg1; |
|
|
|
|
struct colour i = get_scene_watch()->colours.bg; |
|
|
|
|
|
|
|
|
|
if (mute_button.held) { |
|
|
|
|
struct colour t = c; |
|
|
|
|
c = i;
|
|
|
|
|
i = t; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SDL_Rect rect; |
|
|
|
|
|
|
|
|
|
rect.x = mute_button.x; |
|
|
|
|
rect.y = mute_button.y;
|
|
|
|
|
rect.w = mute_button.w; |
|
|
|
|
rect.h = mute_button.h; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SDL_SetRenderDrawColor(ren, c.r, c.g, c.b, 255); |
|
|
|
|
SDL_RenderFillRect(ren, &rect); |
|
|
|
|
|
|
|
|
|
rect.x += mute_button.w / 6; |
|
|
|
|
rect.y += mute_button.w / 4; |
|
|
|
|
rect.w = mute_button.w / 5; |
|
|
|
|
rect.h = mute_button.h / 2; |
|
|
|
|
|
|
|
|
|
SDL_SetRenderDrawColor(ren, i.r, i.g, i.b, 255); |
|
|
|
|
SDL_RenderFillRect(ren, &rect); |
|
|
|
|
|
|
|
|
|
int j = 0; |
|
|
|
|
for (int i = rect.x + rect.w; i < rect.x + rect.w + mute_button.w / 5; i++) { |
|
|
|
|
SDL_RenderDrawLine(ren, i, rect.y + j + rect.h, i, rect.y - j); |
|
|
|
|
j++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
j -= 8; |
|
|
|
|
if (!mute_button.state) { |
|
|
|
|
for (int i = rect.x + rect.w + mute_button.w / 5;
|
|
|
|
|
i < mute_button.x + mute_button.w - 5; i++) { |
|
|
|
|
if ((i) % 8 < 4) { |
|
|
|
|
SDL_RenderDrawLine(ren, i, rect.y + j + rect.h, i, rect.y - j); |
|
|
|
|
} |
|
|
|
|
if (i % 8 == 0) j += 4; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
int w = mute_button.w / 5; |
|
|
|
|
int i = rect.x + rect.w + mute_button.w / 5 + w/2; |
|
|
|
|
int j = rect.y + w / 2; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
i += 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
i -= 1; |
|
|
|
|
|
|
|
|
|
j += 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
j -= 1; |
|
|
|
|
|
|
|
|
|
j += 1; |
|
|
|
|
i += 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
j -= 1; |
|
|
|
|
i -= 1; |
|
|
|
|
|
|
|
|
|
i -= 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
i += 1; |
|
|
|
|
|
|
|
|
|
j -= 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
j += 1; |
|
|
|
|
|
|
|
|
|
j -= 1; |
|
|
|
|
i -= 1; |
|
|
|
|
SDL_RenderDrawLine(ren, i, j + w, i + w, j); |
|
|
|
|
SDL_RenderDrawLine(ren, i + w, j + w, i, j); |
|
|
|
|
j += 1; |
|
|
|
|
i += 1; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void draw_pause_screen(SDL_Renderer *ren, struct environment *e) { |
|
|
|
@ -802,6 +894,7 @@ void redraw_buffer(SDL_Renderer * ren) {
@@ -802,6 +894,7 @@ void redraw_buffer(SDL_Renderer * ren) {
|
|
|
|
|
lplayer.colliding); |
|
|
|
|
draw_collision_poly(ren, &lplayer); |
|
|
|
|
draw_forces(ren, &lplayer); |
|
|
|
|
draw_mute_button(ren); |
|
|
|
|
|
|
|
|
|
if (gameui.currently_bound_textbox) { |
|
|
|
|
draw_level_chooser_tbox(ren); |
|
|
|
|