-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGridVisuals.cpp
More file actions
69 lines (52 loc) · 1.85 KB
/
Copy pathGridVisuals.cpp
File metadata and controls
69 lines (52 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by waylon on 5/18/26.
//
#include "GridVisuals.h"
#include <iostream>
#include <ostream>
// Define our global config objects that we promised in the header
const ScreenSize screensize;
const Grid grid;
// Constructor implementation
RGB::RGB(int r, int g, int b) {
this->r = r;
this->g = g;
this->b = b;
}
void RGB::smoothRed() {
if (r >= 255) flip = true;
else if (r <= 0) flip = false;
if (flip) r--;
else r++;
}
void RGB::smoothblue() {
if (b >= 255) flip = true;
else if (b <= 0) flip = false;
if (flip) b--;
else b++;
}
void RGB::smoothGreen() {
}
/*void drawGrid(SDL_Renderer* renderer) {
for (int i = grid.x; i < screensize.x; i += grid.x) {
for (int j = grid.y; j < screensize.y; j += grid.y) {
SDL_FRect rect;
SDL_SetRenderDrawColor(renderer, rgb.r, rgb.g, rgb.b, 255);
rect.x = i;
rect.y = j;
rect.w = static_cast<float>(screensize.x) / grid.x;
rect.h = static_cast<float>(screensize.y) / grid.y;
SDL_RenderFillRect(renderer, &rect);
}
}
}*/
void drawCourt(SDL_Renderer* renderer) {
SDL_SetRenderDrawColor(renderer, court.getCourtColor().r, court.getCourtColor().r, court.getCourtColor().r, 255);
SDL_RenderRect(renderer, &court.getRect());
SDL_SetRenderDrawColor(renderer,ball.getBallColor().r, ball.getBallColor().g, ball.getBallColor().b, 255);
SDL_RenderFillRect(renderer, &ball.getRect());
SDL_SetRenderDrawColor(renderer, paddle1.getPaddleColor().r,paddle1.getPaddleColor().g,paddle1.getPaddleColor().b, 255);
SDL_RenderFillRect(renderer, &paddle1.getRect());
SDL_SetRenderDrawColor(renderer, paddle2.getPaddleColor().r,paddle2.getPaddleColor().g,paddle2.getPaddleColor().b, 255);
SDL_RenderFillRect(renderer, &paddle2.getRect());
}