add linux support
This commit is contained in:
26
src/app.cpp
26
src/app.cpp
@@ -23,6 +23,9 @@ void async_lock();
|
||||
void win32_async_swap();
|
||||
void async_unlock();
|
||||
void destroy_window();
|
||||
#elif __LINUX__
|
||||
std::string linux_home_path();
|
||||
int mkpath(const std::string& dir, mode_t mode = DEFFILEMODE);
|
||||
#endif
|
||||
|
||||
App* App::I = nullptr; // singleton
|
||||
@@ -131,9 +134,10 @@ bool App::request_close()
|
||||
#ifdef _WIN32
|
||||
destroy_window();
|
||||
//PostQuitMessage(0);
|
||||
#endif
|
||||
#ifdef __OSX__
|
||||
#elif __OSX__
|
||||
[osx_view close];
|
||||
#elif __LINUX__
|
||||
glfwSetWindowShouldClose(glfw_window, GLFW_TRUE);
|
||||
#endif
|
||||
Canvas::I->m_unsaved = false;
|
||||
};
|
||||
@@ -223,6 +227,15 @@ void App::initLog()
|
||||
|
||||
if (!PathFileExistsA((data_path + "\\settings").c_str()))
|
||||
CreateDirectoryA((data_path + "\\settings").c_str(), NULL);
|
||||
|
||||
#elif __LINUX__
|
||||
data_path = linux_home_path() + "/PanoPainter";
|
||||
mkpath(data_path + "/brushes");
|
||||
mkpath(data_path + "/brushes/thumbs");
|
||||
mkpath(data_path + "/patterns");
|
||||
mkpath(data_path + "/patterns/thumbs");
|
||||
mkpath(data_path + "/settings");
|
||||
mkpath(data_path + "/frames");
|
||||
#endif
|
||||
|
||||
// TODO: save this path somewhere in the settings, don't overwrite every start
|
||||
@@ -452,6 +465,8 @@ void App::async_start()
|
||||
#elif _WIN32
|
||||
async_lock();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
#elif __LINUX__
|
||||
glfwMakeContextCurrent(glfw_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -484,6 +499,8 @@ void App::async_swap()
|
||||
android_async_swap();
|
||||
#elif _WIN32
|
||||
win32_async_swap();
|
||||
#elif __LINUX__
|
||||
glfwSwapBuffers(glfw_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -582,7 +599,7 @@ void App::draw(float dt)
|
||||
LOG("rec tick");
|
||||
rec_timer = 0.f;
|
||||
|
||||
auto data = new uint8_t[width * height * 4];
|
||||
auto data = new uint8_t[(int)width * (int)height * 4];
|
||||
#if __IOS__
|
||||
[ios_view->glview bindDrawable];
|
||||
#else
|
||||
@@ -913,6 +930,9 @@ void App::ui_thread_main()
|
||||
#ifdef _WIN32
|
||||
extern void win32_update_fps(int frames);
|
||||
win32_update_fps(rendered_frames);
|
||||
#elif __LINUX__
|
||||
extern void linux_update_fps(int frames);
|
||||
linux_update_fps(rendered_frames);
|
||||
#endif
|
||||
t_fps_counter = 0;
|
||||
rendered_frames = 0;
|
||||
|
||||
Reference in New Issue
Block a user