| 112 | } |
| 113 | |
| 114 | int main(int argc, char** argv){ |
| 115 | window = new Lemon::GUI::Window("LemonPaint", {800, 500}, 0, Lemon::GUI::WindowType::GUI); |
| 116 | |
| 117 | canvas = new Canvas({{80,0},{656, 496}}, {640, 480}); |
| 118 | memset(canvas->surface.buffer, 0, 640*480*4); |
| 119 | |
| 120 | Brush* brush = new Brush(); |
| 121 | brush->data = (surface_t){.width = 1, .height = 1, .depth = 32, .buffer = brush0}; |
| 122 | brushes.push_back(brush); |
| 123 | canvas->currentBrush = brush; |
| 124 | |
| 125 | window->AddWidget(canvas); |
| 126 | |
| 127 | brush = new Brush(); |
| 128 | brush->data = (surface_t){.width = 8, .height = 8, .depth = 32, .buffer = brush1}; |
| 129 | brushes.push_back(brush); |
| 130 | |
| 131 | int yPos = 0; |
| 132 | for(int i = 0; i < DEFAULT_COLOUR_COUNT / 2; i++){ |
| 133 | Colour* c1 = new Colour((rect_t){{2, yPos}, {16, 16}}); |
| 134 | c1->colour = defaultColours[i * 2]; |
| 135 | window->AddWidget(c1); |
| 136 | |
| 137 | Colour* c2 = new Colour((rect_t){{20, yPos}, {16, 16}}); |
| 138 | c2->colour = defaultColours[i * 2 + 1]; |
| 139 | window->AddWidget(c2); |
| 140 | |
| 141 | yPos += 18; |
| 142 | } |
| 143 | |
| 144 | Lemon::GUI::Button* openButton = new Lemon::GUI::Button("Open...", {{2, yPos}, {76, 24}}); |
| 145 | openButton->OnPress = OnOpen; |
| 146 | |
| 147 | window->AddWidget(openButton); |
| 148 | |
| 149 | yPos += 26; |
| 150 | Lemon::GUI::Button* saveButton = new Lemon::GUI::Button("Save...", {{2, yPos}, {76, 24}}); |
| 151 | saveButton->OnPress = OnSave; |
| 152 | window->AddWidget(saveButton); |
| 153 | |
| 154 | yPos += 26; |
| 155 | Lemon::GUI::Button* brush0Button = new Lemon::GUI::Button("Brush 0", {{2, yPos}, {76, 24}}); |
| 156 | brush0Button->OnPress = OnPressBrush0; |
| 157 | window->AddWidget(brush0Button); |
| 158 | |
| 159 | yPos += 26; |
| 160 | Lemon::GUI::Button* brush1Button = new Lemon::GUI::Button("Brush 1", {{2, yPos}, {76, 24}}); |
| 161 | brush1Button->OnPress = OnPressBrush1; |
| 162 | window->AddWidget(brush1Button); |
| 163 | |
| 164 | yPos += 26; |
| 165 | Lemon::GUI::Button* scaleButton1 = new Lemon::GUI::Button("Scale 25%", {{2, yPos}, {76, 24}}); |
| 166 | scaleButton1->OnPress = OnPressBrushScale25; |
| 167 | window->AddWidget(scaleButton1); |
| 168 | |
| 169 | yPos += 26; |
| 170 | Lemon::GUI::Button* scaleButton2 = new Lemon::GUI::Button("Scale 50%", {{2, yPos}, {76, 24}}); |
| 171 | scaleButton2->OnPress = OnPressBrushScale50; |