image + widow inherit from surface + text.hpp

This commit is contained in:
arthur.jamet
2021-05-14 11:44:51 +02:00
parent cf84d66250
commit c38006605c
4 changed files with 118 additions and 2 deletions
+44
View File
@@ -0,0 +1,44 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** Text
*/
#ifndef TEXT_HPP_
#define TEXT_HPP_
#include "Drawables/Drawable.hpp"
#include <string>
namespace Ray {
class Text: public Drawable
{
public:
Text(const std::string &text, int fontSize, Vector2 position, Color);
Text(const std::string &text, int fontSize, int x, int y, Color);
Text(const Text &);
Text &operator=(const Text &);
~Text() = default;
const std::string &getString(void);
int getFontSize(void);
Text &setText(const std::string &text);
Text &setFontSize(int size);
bool collide(const Text &);
bool collide(const Line &);
bool collide(const Point &);
bool collide(const Circle &);
private:
std::string _text;
int _size;
};
};
#endif /* !TEXT_HPP_ */
+44
View File
@@ -0,0 +1,44 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** Image
*/
#ifndef IMAGE_HPP_
#define IMAGE_HPP_
#include <raylib.h>
#include <string>
#include "Surface.hpp"
namespace Ray
{
class Image {
public:
Image(const std::string &filename);
Image(const Image &);
Image();
Image &operator=(const Image &);
bool load(const std::string &filename);
bool exportTo(const std::string &outputPath);
bool unload();
const ::Image &getImage(void) const;
~Image();
void drawRectangle(const Rectangle &);
void drawLine(const Line &);
void drawPoint(const Point &);
void drawCircle(const Circle &);
protected:
private:
::Image _image;
};
}
#endif /* !IMAGE_HPP_ */
+28
View File
@@ -0,0 +1,28 @@
/*
** EPITECH PROJECT, 2021
** Bomberman
** File description:
** Surface
*/
#ifndef SURFACE_HPP_
#define SURFACE_HPP_
#include "Drawables/Drawable.hpp"
namespace Ray {
class Surface {
public:
virtual ~Surface() = 0;
virtual void drawRectangle(const Rectangle &) = 0;
virtual void drawLine(const Line &) = 0;
virtual void drawPoint(const Point &) = 0;
virtual void drawCircle(const Circle &) = 0;
protected:
private:
};
}
#endif /* !SURFACE_HPP_ */
+2 -2
View File
@@ -12,10 +12,10 @@
#include <string>
#include "Vector.hpp"
#include "Keyboard.hpp"
#include "Drawable.hpp"
#include "Surface.hpp"
namespace Ray {
class Window {
class Window: public Surface {
public:
// Creates window, and opens it if openNow is set to true
Window(int width, int height, const std::string title, bool openNow = false);