>>107235206
>What are you working on, /g/?
im making pong
going pretty well I think
#include "pong.h"
#include "raylib.h"
GameState initializePong(void) {
GameState state = {0};
Ball ball = {.ball =
{
.position = (Vector2){2.0, 2.0},
.velocity = (Vector2){0.0, 0.0},
},
.radius = BALL_RADIUS};
Paddle paddleL = {.paddle = {.position = (Vector2){20.0, 100.0},
.velocity = ((Vector2){0.0, 0.0})},
.side = LEFT,
.width = PADDLE_WIDTH,
.height = PADDLE_HEIGHT};
Paddle paddleR = {.paddle = {.position = (Vector2){200.0, 100.0},
.velocity = ((Vector2){0.0, 0.0})},
.side = RIGHT,
.width = PADDLE_WIDTH,
.height = PADDLE_HEIGHT};
state.paddleLeft = paddleL;
state.paddleRight = paddleR;
state.ball = ball;
state.scoreL = 0;
state.scoreR = 0;
return state;
}
// GameState resetPong(GameState state) {}
// GameState update(GameState state, float dt) {}
void draw(GameState state, float dt) {
// Draw the ball
DrawCircle(state.ball.ball.position.x, state.ball.ball.position.y,
state.ball.radius, BLACK);
// Draw the paddles
DrawRectangle(state.paddleLeft.paddle.position.x,
state.paddleLeft.paddle.position.y, state.paddleLeft.width,
state.paddleLeft.height, BLACK);
DrawRectangle(state.paddleRight.paddle.position.x,
state.paddleRight.paddle.position.y, state.paddleRight.width,
state.paddleRight.height, BLACK);
}
// Entity updateEntity(Entity e){}