Ajout de la fonction render au monde
Joueur déplaçable début du cast de rayon Trop fatigué pour faire de la trigo
This commit is contained in:
parent
76306196c0
commit
59939d182b
5 changed files with 117 additions and 4 deletions
16
World.h
16
World.h
|
@ -7,6 +7,10 @@
|
|||
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "Player.h"
|
||||
|
||||
enum class BlockType {
|
||||
AIR,
|
||||
|
@ -17,19 +21,29 @@ enum class BlockType {
|
|||
|
||||
class World {
|
||||
public:
|
||||
World(int w, int h, std::vector<BlockType> worldMap = {});
|
||||
Player player;
|
||||
|
||||
World(int w, int h, sf::Color groundColor = sf::Color::Green, sf::Color ceilingColor = sf::Color::Blue,
|
||||
std::vector<BlockType> worldMap = {});
|
||||
int getW() const;
|
||||
int getH() const;
|
||||
|
||||
BlockType getBlock(float x, float y) const;
|
||||
void setBlock(BlockType block, int x, int y, int width = 1, int height = 1);
|
||||
|
||||
void render(sf::RenderWindow&) const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& ostream, World const & world);
|
||||
private:
|
||||
int w;
|
||||
int h;
|
||||
std::vector<BlockType> map;
|
||||
|
||||
sf::Color groundColor;
|
||||
sf::Color ceilingColor;
|
||||
|
||||
void fillColumn(sf::RenderWindow&, int column, float scale, sf::Color wallColor = sf::Color(127,127,127)) const;
|
||||
float castRay(float originX, float originY, float orientation);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue