-
Notifications
You must be signed in to change notification settings - Fork 0
/
Project.h
74 lines (58 loc) · 1.51 KB
/
Project.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once
#ifndef PROJECT_H
#define PROJECT_H
#include <imgui.h>
#include <vector>
#include "Layer.h"
#include <string>
namespace SpriteLab
{
struct ProjectSettings
{
ImVec2 size;
float zoom = 1;
};
struct Brush
{
SDL_Color colour = { 0,0,0,255 };
int size = 1;
};
enum Tools
{
PaintBrush,
PaintBucket,
Eraser,
EyeDropper,
Line
};
struct Project
{
std::string name = "";
Tools selectedTool = PaintBrush;
std::string selectedToolString = "PaintBrush";
Brush brush;
ProjectSettings projectSettings;
bool bestZoomSet = false;
bool saved = true;
ImVec2 canvasMinPos;
ImVec2 canvasMaxPos;
std::vector<SDL_Color> recentColours;
std::vector<Layer> layers;
Layer* selectedLayer;
std::string lastSaveLocation = "";
std::string lastExportLocation = "";
std::string lastSaveName = "";
std::string lastExportName = "";
bool Compare(Project other)
{
return (name == other.name && lastSaveLocation == other.lastSaveLocation);
}
float GetBestCanvasZoom()
{
int x = floor(ImGui::GetWindowSize().x / projectSettings.size.x);
int y = floor(ImGui::GetWindowSize().y / projectSettings.size.y);
return (x < y) ? x : y;
}
};
}
#endif