7#include "CanvasLib/Color.hpp"
8#include "CanvasLib/Colors.hpp"
9#include "CanvasLib/Vec2.hpp"
10#include <GLFW/glfw3.h>
11#include <RenderAbstraction.hpp>
14#define CANVASLIB_EXPORT
71 Canvas(uint32_t width, uint32_t height);
94 void drawEllipse(
float cx,
float cy,
float rx,
float ry,
int segments = 40);
120 static void setWatch(
const std::string& key,
const std::string& value);
128 [[nodiscard]]
auto _xToGl(
float x)
const -> float;
129 [[nodiscard]]
auto _yToGl(
float y)
const -> float;
130 [[nodiscard]]
auto _normalizeSizeGl(
const Vec2f& size)
const ->
Vec2f;
132 static void renderWatches();
133 static bool s_ShouldRenderWatches;
134 static std::unique_ptr<std::thread> s_WatchesRenderThread;
135 static std::mutex s_CustomWatchesMutex;
136 static std::unordered_map<std::string, std::string> s_CustomWatches;
138 void applyColorGl()
const;
140 std::unique_ptr<Ra::Window> m_Window;
141 std::function<void(
double)> m_UpdateFunction;
143 Ra::RendererAPI::DrawMode m_DrawMode;
145 glm::mat4 m_Projection;
146 double m_LastFrameTime;
The main class representing the canvas. To use it you only need to:
Definition CanvasLib.hpp:55
static void disableWatches()
Disables rendering watches in terminal.
static void enableWatches()
Enables rendering watches in terminal.
void setFillColor(const Color &color)
sets the fill color
void drawRectangle(float x, float y, float w, float h)
draws a rectangle with specified coordinates and size
Canvas(uint32_t width, uint32_t height)
Initializes the name field to the name of the project.
static void setWatch(const std::string &key, const std::string &value)
Adds or updates entry in watches table.
void setDrawMode(const DrawMode &drawMode)
sets draw mode from Canvas::DrawMode enum
void drawEllipse(float cx, float cy, float rx, float ry, int segments=40)
draws an ellipse, if u want circle just pass same x and y radius for triangle use segments = 3
void setUpdateFunction(std::function< void(double)> upd)
sets update function that will be called every frame
static void removeWatch(const std::string &key)
Removes entry from watches table, does nothing if it doesn't exist.
void start()
starts the main window cycle IN MAIN THREAD
Utility Color class operating uint8(0..255) values.
Definition Color.hpp:15
Utility Vec2 class with x, y coordinates.
Definition Vec2.hpp:16
Definition CanvasLib.hpp:44