casse-brick latest
Ce projet est réalisé dans le cadre du cours de Programmation Avancée en M1 Informatique de l'université de Strasbourg.
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1//
2// Created by nicolas elfering on 15.04.24.
3//
4
5#ifndef CASSE_BRIQUE_PLATFORM_H
6#define CASSE_BRIQUE_PLATFORM_H
7
8#include <SDL2/SDL.h>
9#include <SDL_image.h>
10#include <SDL2/SDL_timer.h>
11#include <iostream>
12#include <memory>
13
14#include "CollidingObject.h"
20class PLATFORM : public MovingObject {
21private:
24 int speed;
25 std::shared_ptr<SDL_Renderer> renderer;
26
27public:
38 PLATFORM(std::shared_ptr<SDL_Renderer> renderer, int x, int y, int min, int max, int speed);
39
46 void input(SDL_KeyboardEvent event, bool up);
47
55 void render(std::shared_ptr<SDL_Renderer> renderer, SDL_Color color1, SDL_Color color2) override;
56
62 void handleCollisions(point collision) override {};
63
67 void move() override;
68};
69
70
71#endif //CASSE_BRIQUE_PLATFORM_H
The MovingObject class represents a moving colliding object.
The PLATFORM class represents a movable platform object.
Definition platform.h:20
void render(std::shared_ptr< SDL_Renderer > renderer, SDL_Color color1, SDL_Color color2) override
Renders the platform on the screen.
Definition platform.cpp:26
void move() override
Moves the platform horizontally.
Definition platform.cpp:31
void handleCollisions(point collision) override
Handles collisions with other objects.
Definition platform.h:62
int min_width
The minimum width of the platform's movement range.
Definition platform.h:23
void input(SDL_KeyboardEvent event, bool up)
Handles input events for moving the platform.
Definition platform.cpp:13
int speed
The speed at which the platform moves.
Definition platform.h:24
int max_width
The maximum width of the platform's movement range.
Definition platform.h:22
std::shared_ptr< SDL_Renderer > renderer
A shared pointer to the SDL renderer.
Definition platform.h:25
The point struct represents a point in 2D space.