139 lines
3.6 KiB
Objective-C
139 lines
3.6 KiB
Objective-C
#pragma once
|
|
|
|
#include "log.h"
|
|
#include "shader.h"
|
|
#include "shape.h"
|
|
#include "texture.h"
|
|
#include "layout.h"
|
|
#include "font.h"
|
|
#include "node_message_box.h"
|
|
#include "node_settings.h"
|
|
#include "node_popup_menu.h"
|
|
#include "node_panel_brush.h"
|
|
#include "node_panel_layer.h"
|
|
#include "node_panel_color.h"
|
|
#include "node_panel_stroke.h"
|
|
#include "node_scroll.h"
|
|
#include "node_canvas.h"
|
|
#include "node_dialog_layer_rename.h"
|
|
|
|
#if defined(__OBJC__) && defined(__IOS__)
|
|
#import <Foundation/Foundation.h>
|
|
#import "GameViewController.h"
|
|
#endif
|
|
|
|
#if defined(__OBJC__) && defined(__OSX__)
|
|
#import "main.h"
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
#include "main.h"
|
|
#endif
|
|
|
|
class App
|
|
{
|
|
public:
|
|
static App I;
|
|
std::string data_path{ "." };
|
|
Sampler sampler;
|
|
Texture2D tex;
|
|
LayoutManager layout;
|
|
NodeMessageBox* msgbox;
|
|
NodeSettings* settings;
|
|
NodePopupMenu* popup = nullptr;
|
|
NodePopupMenu* menu_file = nullptr;
|
|
NodePopupMenu* menu_edit = nullptr;
|
|
NodePopupMenu* menu_layers = nullptr;
|
|
NodeBorder* sidebar = nullptr;
|
|
std::shared_ptr<NodePanelBrush> brushes;
|
|
std::shared_ptr<NodePanelLayer> layers;
|
|
std::shared_ptr<NodePanelColor> color;
|
|
std::shared_ptr<NodePanelStroke> stroke;
|
|
std::shared_ptr<NodePanelBrushPreset> presets;
|
|
NodeCanvas* canvas;
|
|
Node* current_panel = nullptr;
|
|
NodeScroll* panels;
|
|
const uint16_t main_id = const_hash("main");
|
|
std::string doc_name;
|
|
float width;
|
|
float height;
|
|
bool keys[256];
|
|
bool redraw = true;
|
|
bool animate = false;
|
|
glm::vec2 gesture_p0;
|
|
glm::vec2 gesture_p1;
|
|
#ifdef __ANDROID__
|
|
float zoom = 3.0;
|
|
#elif __IOS__
|
|
float zoom = 2.0;
|
|
#else
|
|
float zoom = 1.0;
|
|
#endif // __ANDROID__
|
|
|
|
#if defined(__IOS__) && defined(__OBJC__)
|
|
GameViewController* ios_view;
|
|
#endif
|
|
|
|
#if defined(__OSX__) && defined(__OBJC__)
|
|
View* osx_view;
|
|
#endif
|
|
|
|
#ifdef __ANDROID__
|
|
struct android_app* and_app;
|
|
struct engine* and_engine;
|
|
#endif
|
|
void pick_image(std::function<void(std::string path)> callback);
|
|
void showKeyboard();
|
|
void hideKeyboard();
|
|
void initLog();
|
|
void init();
|
|
void initShaders();
|
|
void initAssets();
|
|
void initLayout();
|
|
void create();
|
|
void terminate();
|
|
void clear();
|
|
void update_memory_usage(size_t bytes);
|
|
void update(float dt);
|
|
void async_start();
|
|
void async_update();
|
|
void async_end();
|
|
void resize(float w, float h);
|
|
bool mouse_down(int button, float x, float y, float pressure, kEventSource source);
|
|
bool mouse_move(float x, float y, float pressure, kEventSource source);
|
|
bool mouse_up(int button, float x, float y, kEventSource source);
|
|
bool mouse_scroll(float x, float y, float delta);
|
|
bool mouse_cancel(int button);
|
|
bool gesture_start(const glm::vec2& p0, const glm::vec2& p1);
|
|
bool gesture_move(const glm::vec2& p0, const glm::vec2& p1);
|
|
bool gesture_end();
|
|
bool key_down(kKey key);
|
|
bool key_up(kKey key);
|
|
bool key_char(char key);
|
|
|
|
void init_toolbar_main();
|
|
void init_toolbar_draw();
|
|
void init_sidebar();
|
|
void init_menu_file();
|
|
void init_menu_edit();
|
|
void init_menu_layer();
|
|
void dialog_newdoc();
|
|
void dialog_save();
|
|
void dialog_save_ver();
|
|
void dialog_open();
|
|
void dialog_browse();
|
|
void dialog_export();
|
|
void dialog_layer_rename();
|
|
|
|
void cloud_upload();
|
|
void cloud_upload_all();
|
|
void cloud_browse();
|
|
void upload(std::string filename, std::string name = "");
|
|
void download(std::string filename);
|
|
|
|
void brush_update();
|
|
void title_update(std::string name, int resolution);
|
|
|
|
void cmd_convert(std::string pano_path, std::string out_path);
|
|
};
|