LibraryViewer

This commit is contained in:
IlyaShurupov 2023-11-28 23:22:04 +03:00
parent 5a55011911
commit c7d3b15758
24 changed files with 226111 additions and 36 deletions

View file

@ -32,9 +32,9 @@ namespace tp {
class AnimRect : Rect<AnimValue> {
public:
AnimRect() {
set({ 0, 0, 0, 0 });
AnimRect() {
setAnimTime(450);
setNoTransition({ 0, 0, 0, 0 });
}
[[nodiscard]] RectF get() const;
@ -45,9 +45,10 @@ namespace tp {
};
class AnimColor {
public:
AnimColor();
AnimRect mColor;
public:
[[nodiscard]] RGBA get() const;
void set(const RGBA&);
};

View file

@ -2,6 +2,8 @@
#include "GraphicsCommon.hpp"
// TODO : fix this ugly shit
namespace tp {
class Window;
@ -13,17 +15,22 @@ namespace tp {
private:
friend Graphics;
friend Window;
GL();
~GL();
void init();
void deinit();
static void proc();
static void draw();
void proc();
void draw();
public:
// TODO : API
private:
halnf mWidth = 100;
halnf mHeight = 100;
};
class GUI {
@ -51,6 +58,7 @@ namespace tp {
private:
friend Graphics;
friend Window;
Canvas();
~Canvas();
@ -61,7 +69,27 @@ namespace tp {
void draw();
public:
enum Align : int2 {
CC = 0x0000,
CT = 0x0001,
CB = 0x0002,
LC = 0x0100,
LT = 0x0101,
LB = 0x0102,
RC = 0x0200,
RT = 0x0201,
RB = 0x0202,
};
RectF getAvaliableArea();
void rect(const RectF& rec, const RGBA& col, halnf round = 0);
void text(const String&, const RectF&, halnf size, Align, halnf marging, const RGBA&);
// TODO : API
private:
halnf mWidth = 600;
halnf mHeight = 600;
};
private:

View file

@ -1,5 +1,7 @@
#pragma once
// TODO : fix this ugly shit
#include "Buffer.hpp"
#include "Graphics.hpp"
#include "Keycodes.hpp"
@ -14,10 +16,23 @@ namespace tp {
enum Type {
KEY,
MOUSE,
};
};
struct Events {
Vec2F mPointer;
const Vec2F& getPos() const;
bool isPressed() const;
bool isDown() const;
halnf getScrollY() const;
private:
friend Window;
Buffer<Event> mQueu;
Context* mContext;
};
private:
Window(int width, int height, const char* title);
~Window();
@ -33,10 +48,12 @@ namespace tp {
auto getContext() -> Context*;
Graphics::Canvas& getCanvas();
const Events& getEvents();
private:
Context* mContext;
Graphics mGraphics;
Buffer<Event> mEvents;
Events mEvents;
};
}