Update render.c

This commit is contained in:
Jason Bou-Samra
2024-08-27 19:24:39 +10:00
committed by GitHub
parent f7808b839b
commit f33afc1da3
+12 -7
View File
@@ -240,18 +240,23 @@ int display_grid() {
//////////////// GAME LOGIC //////////////// //////////////// GAME LOGIC ////////////////
int game_logic(void) { int game_logic(void) {
// new_brick();
count_col();
printf("colcnt[%i]: %i, row: %i\n", col, colcnt[col], row);
disp_column (row, col); disp_column (row, col);
row++;
grid[0][row - 2][col] = 0; grid[0][row - 2][col] = 0;
if(row > 16) { if(row == colcnt[col]) {
grid[0][15][col] = 0;
grid[0][16][col] = 0;
grid[0][17][col] = 0;
row = 0; row = 0;
for (int i = 0; i < 3; i++) {
tile_current[i] = tile_next[i];
}
new_brick();
col = new_column();
} }
row++;
} }
///////////////// RENDER FRAME //////////////.. ///////////////// RENDER FRAME //////////////
int Ren_frame() { int Ren_frame() {
backdrop(colour); backdrop(colour);
@@ -274,7 +279,7 @@ int Ren_game(void) {
{ {
current_time = SDL_GetTicks(); current_time = SDL_GetTicks();
deltatime = current_time - last_time; deltatime = current_time - last_time;
if (deltatime > 1000) { if (deltatime > 200) {
last_time = current_time; last_time = current_time;
deltatime = 0; deltatime = 0;
game_logic(); game_logic();