Added draw function to screens

This commit is contained in:
Yousef Khadadeh 2026-04-17 19:32:49 +03:00
parent 5a0086c4ea
commit db6dffb4ee
10 changed files with 46 additions and 13 deletions

View file

@ -11,6 +11,10 @@ void DrawingProgramScreen::update() {
main.world->focus_update();
}
void DrawingProgramScreen::draw(SkCanvas* canvas) {
main.draw_world(canvas, main.world, main.world->drawData);
}
void DrawingProgramScreen::gui_layout_run() {
toolbar.layout_run();
}

View file

@ -6,6 +6,7 @@ class DrawingProgramScreen : public Screen {
public:
DrawingProgramScreen(MainProgram& m);
virtual void update() override;
virtual void draw(SkCanvas* canvas) override;
virtual void gui_layout_run() override;
virtual bool app_close_requested() override;
virtual void input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile) override;

View file

@ -1 +1,20 @@
#include "FileSelectScreen.hpp"
#include "../MainProgram.hpp"
#include "../GUIHolder.hpp"
#include "../GUIStuff/ElementHelpers/TextLabelHelpers.hpp"
FileSelectScreen::FileSelectScreen(MainProgram& m): Screen(m) {}
void FileSelectScreen::gui_layout_run() {
using namespace GUIStuff;
using namespace ElementHelpers;
CLAY_AUTO_ID({
.layout = {}
}) {
text_label(main.g.gui, "File select screen");
}
}
void FileSelectScreen::draw(SkCanvas* canvas) {
canvas->clear(SkColor4f{0.0f, 0.0f, 0.0f, 0.0f});
}

View file

@ -1,7 +1,9 @@
#pragma once
#include "Screen.hpp"
class FileSelectScreen {
class FileSelectScreen : public Screen {
public:
FileSelectScreen();
private:
FileSelectScreen(MainProgram& m);
virtual void gui_layout_run() override;
virtual void draw(SkCanvas* canvas) override;
};

View file

@ -6,7 +6,7 @@ Screen::Screen(MainProgram& m):
void Screen::update() {}
void Screen::gui_layout_run() {}
bool Screen::app_close_requested() { return false; }
bool Screen::app_close_requested() { return true; }
void Screen::input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile) {}
void Screen::input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {}
void Screen::input_paste_callback(const CustomEvents::PasteEvent& paste) {}

View file

@ -5,6 +5,7 @@ class Screen {
public:
Screen(MainProgram& m);
virtual void update();
virtual void draw(SkCanvas* canvas) = 0;
virtual void gui_layout_run();
virtual bool app_close_requested();