You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
C
80 lines
2.6 KiB
C
|
5 years ago
|
/******************************************************************************
|
||
|
4 years ago
|
* File - graphics.h
|
||
|
5 years ago
|
* Author - Joey Pollack
|
||
|
|
* Date - 2021/09/02 (y/m/d)
|
||
|
|
* Mod Date - 2021/09/02 (y/m/d)
|
||
|
|
* Description - Graphics interface for the engine.
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
#ifndef IGRAPHICS_H_
|
||
|
|
#define IGRAPHICS_H_
|
||
|
|
|
||
|
4 years ago
|
#include <core/types.h>
|
||
|
5 years ago
|
#include <utils/opRes.h>
|
||
|
|
|
||
|
|
namespace lunarium
|
||
|
|
{
|
||
|
|
class Core;
|
||
|
|
class Window;
|
||
|
|
class Image;
|
||
|
|
|
||
|
5 years ago
|
enum RenderTarget
|
||
|
5 years ago
|
{
|
||
|
5 years ago
|
RT_WINDOW,
|
||
|
|
RT_IMAGE
|
||
|
5 years ago
|
};
|
||
|
|
|
||
|
|
class IGraphics
|
||
|
|
{
|
||
|
|
protected: // Interface methods for use only by the engine
|
||
|
|
friend Core;
|
||
|
|
|
||
|
4 years ago
|
IGraphics() : mbIsInit(false) {}
|
||
|
5 years ago
|
|
||
|
5 years ago
|
virtual OpRes Initialize(Window* pWindow, bool enableDebugMessages = true) = 0;
|
||
|
5 years ago
|
virtual void Shutdown() = 0;
|
||
|
|
|
||
|
|
virtual void ResizeCanvas() = 0;
|
||
|
|
|
||
|
4 years ago
|
// framebuffer is the ID of the texture/framebuffer to render to
|
||
|
|
// -1 means draw to the default (most likely the main window) buffer
|
||
|
|
virtual void BeginDraw(int framebuffer = -1) = 0;
|
||
|
5 years ago
|
virtual Image* EndDraw() = 0;
|
||
|
5 years ago
|
|
||
|
|
public: //
|
||
|
|
|
||
|
|
virtual void SetClearColor(Color c) = 0;
|
||
|
|
virtual Color GetClearColor() const = 0;
|
||
|
|
|
||
|
4 years ago
|
virtual int CreateRenderTexture(int width, int height, int channels) = 0;
|
||
|
4 years ago
|
virtual void DestroyRenderTexture(int texture) = 0;
|
||
|
4 years ago
|
|
||
|
5 years ago
|
// Draw Methods
|
||
|
4 years ago
|
virtual void DrawFilledPolygon(float* pVerts, int numVerts, Color color, glm::vec2 position, float angle = 0.0f) = 0;
|
||
|
|
virtual void DrawLine(glm::vec2 point1, glm::vec2 point2, Color color, float lineWidth, float angle = 0.0f) = 0;
|
||
|
5 years ago
|
virtual void DrawEllipse(glm::vec2 center, glm::vec2 radii, Color color, float thickness, int resolution) = 0;
|
||
|
|
virtual void DrawFilledEllipse(glm::vec2 center, glm::vec2 radii, Color color, int resolution) = 0;
|
||
|
4 years ago
|
virtual void DrawBox(Rectangle dimensions, Color color, float thickness, float angle = 0.0f) = 0;
|
||
|
4 years ago
|
virtual void DrawFilledBox(Rectangle box, Color color, float angle = 0.0f) = 0;
|
||
|
4 years ago
|
virtual void DrawImage(Image& image, glm::vec2 position, Color color, float angle = 0.0f) = 0;
|
||
|
4 years ago
|
virtual void DrawImage(Image& image, Rectangle source, Rectangle destination, Color color, float angle = 0.0f) = 0;
|
||
|
5 years ago
|
virtual void DrawString(const char* string, Rectangle boundingArea, Color color, float scale = 1.0f, int font = 0) = 0;
|
||
|
5 years ago
|
|
||
|
4 years ago
|
virtual void RegisterImage(Image& image) = 0;
|
||
|
5 years ago
|
|
||
|
|
// Fonts
|
||
|
5 years ago
|
virtual int DefaultFont() const = 0;
|
||
|
5 years ago
|
|
||
|
|
// For weight, 400 is normal and 700 is bold
|
||
|
5 years ago
|
virtual int CreateNewFont(const char* name, const unsigned char* fontData, int bufferSize, float size = 12.0f, int weight = 400) = 0;
|
||
|
5 years ago
|
|
||
|
|
protected:
|
||
|
|
|
||
|
|
bool mbIsInit;
|
||
|
|
int mDefaultFont;
|
||
|
|
Color mClearColor;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // IGRAPHICS_H_
|