summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-11 22:12:35 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-11 22:12:35 +0100
commit2bd955903676822f6308516bdcb13cb0886fa0ef (patch)
tree666b3e9a547cfb7032c03c380534f2564823a913
parent089f1d902c1f1c89b5b39fd3cf093313be3ebc7f (diff)
export working unix
-rw-r--r--src/export.cpp13
-rw-r--r--src/unix/main_unix.cpp7
2 files changed, 18 insertions, 2 deletions
diff --git a/src/export.cpp b/src/export.cpp
index 23e7bf6..4fc390d 100644
--- a/src/export.cpp
+++ b/src/export.cpp
@@ -3,6 +3,19 @@
#include "config.h"
#include <stdio.h>
+#ifndef _WIN32
+#include <errno.h>
+static int fopen_s(FILE **f, const char *name, const char *mode) {
+ int ret = 0;
+ assert(f);
+ *f = fopen(name, mode);
+ /* Can't be sure about 1-to-1 mapping of errno and MS' errno_t */
+ if (!*f)
+ ret = errno;
+ return ret;
+}
+#endif
+
static bool _str_has_extension(const utf8_int8_t *str, const utf8_int8_t *suffix)
{
if (!str || !suffix)
diff --git a/src/unix/main_unix.cpp b/src/unix/main_unix.cpp
index 9dd9e62..08087b6 100644
--- a/src/unix/main_unix.cpp
+++ b/src/unix/main_unix.cpp
@@ -25,6 +25,7 @@ void ts_create_gui(int window_w, int window_h);
void ts_load_images();
void ts_init();
+GLFWwindow* glfw_window;
bool program_running = true;
char config_path[MAX_INPUT_LENGTH];
@@ -62,8 +63,9 @@ static void glfw_error_callback(int error, const char* description)
int main(int, char**)
{
glfwSetErrorCallback(glfw_error_callback);
- if (!glfwInit())
+ if (!glfwInit()) {
return 1;
+ }
ts_init();
@@ -95,6 +97,7 @@ int main(int, char**)
if (window == nullptr) {
return 1;
}
+ glfw_window = window;
glfwSetWindowSizeLimits(window, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE);
glfwMakeContextCurrent(window);
@@ -165,7 +168,7 @@ bool ts_platform_dir_exists(utf8_int8_t* path) {
}
void ts_platform_set_window_title(utf8_int8_t* str) {
- // TODO
+ glfwSetWindowTitle(glfw_window, str);
}
ts_file_content ts_platform_read_file(char *path, const char *mode) {