|
|
@ -96,7 +96,13 @@ void draw_player(SDL_Renderer * ren, int x, int y, bool red) { |
|
|
|
B = in_view(B); |
|
|
|
B = in_view(B); |
|
|
|
Vect E; |
|
|
|
Vect E; |
|
|
|
E = in_view(player.physics->strings[i].end_point); |
|
|
|
E = in_view(player.physics->strings[i].end_point); |
|
|
|
SDL_RenderDrawLine(ren, B.x, B.y, E.x, E.y); |
|
|
|
|
|
|
|
|
|
|
|
for (int j = -3; j < 3; j++) { |
|
|
|
|
|
|
|
for (int k = -3; k < 3; k++) { |
|
|
|
|
|
|
|
SDL_RenderDrawLine(ren, B.x + j, B.y + k, E.x + j, E.y + k); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -705,6 +711,101 @@ void draw_level_time(SDL_Renderer *ren, const struct environment * e) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
int bars = 0; |
|
|
|
|
|
|
|
int bar_width = mute_button.w / 6; |
|
|
|
|
|
|
|
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 ((bars++) % bar_width >= bar_width / 2) { |
|
|
|
|
|
|
|
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) { |
|
|
|
void draw_pause_screen(SDL_Renderer *ren, struct environment *e) { |
|
|
|
|
|
|
|
|
|
|
|
char *te[] = { "GAME PAUSED.", |
|
|
|
char *te[] = { "GAME PAUSED.", |
|
|
@ -836,6 +937,7 @@ void redraw_buffer(SDL_Renderer * ren) { |
|
|
|
lplayer.colliding); |
|
|
|
lplayer.colliding); |
|
|
|
draw_collision_poly(ren, &lplayer); |
|
|
|
draw_collision_poly(ren, &lplayer); |
|
|
|
draw_forces(ren, &lplayer); |
|
|
|
draw_forces(ren, &lplayer); |
|
|
|
|
|
|
|
draw_mute_button(ren); |
|
|
|
|
|
|
|
|
|
|
|
if (gameui.currently_bound_textbox) { |
|
|
|
if (gameui.currently_bound_textbox) { |
|
|
|
draw_level_chooser_tbox(ren); |
|
|
|
draw_level_chooser_tbox(ren); |
|
|
|