summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2024-03-01 07:16:44 +0000
committer0scar <qgt268@alumni.ku.dk>2024-03-01 07:17:02 +0000
commit7dc8bcecb358ae3863f15016546a0c3789dbb4f4 (patch)
treee179fdbd671214173d5625fd2385656139261de9
parent57a5158400a7e1ccccfd06af292e782d8eff2e4b (diff)
Move get_file_sz
-rw-r--r--src/core/include/engine/engine.h4
-rw-r--r--src/core/src/loop.c17
-rw-r--r--src/rendering/src/gl.c17
3 files changed, 21 insertions, 17 deletions
diff --git a/src/core/include/engine/engine.h b/src/core/include/engine/engine.h
index e15be11..ec716be 100644
--- a/src/core/include/engine/engine.h
+++ b/src/core/include/engine/engine.h
@@ -48,6 +48,10 @@ void render_add_unit(RenderUnit* u);
/* move this */
void delay(uint32_t ms);
+// file operations
+isize f_get_sz(FILE* f);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/core/src/loop.c b/src/core/src/loop.c
index d083e6f..c283a5b 100644
--- a/src/core/src/loop.c
+++ b/src/core/src/loop.c
@@ -398,3 +398,20 @@ void engine_stop(Platform* p) {
/* Set the maximum framerate */
void engine_fps_max(u64 cap) { /* does nothing */ }
+
+isize f_get_sz(FILE* f) {
+ if (f == NULL) {
+ ERROR("File was null!");
+ return 0;
+ }
+
+ const isize pos = ftell(f);
+
+ fseek(f, 0, SEEK_END);
+ const i64 size = ftell(f);
+
+ // Reset the position to the position prior to calling f_get_sz
+ fseek(f, pos, SEEK_SET);
+
+ return size;
+}
diff --git a/src/rendering/src/gl.c b/src/rendering/src/gl.c
index fb45d76..392ac23 100644
--- a/src/rendering/src/gl.c
+++ b/src/rendering/src/gl.c
@@ -22,23 +22,6 @@ const char* ShaderType_str[] = {
[Shader_Compute] = "Shader_Compute",
};
-isize f_get_sz(FILE* f) {
- if (f == NULL) {
- ERROR("File was null!");
- return 0;
- }
-
- const isize pos = ftell(f);
-
- fseek(f, 0, SEEK_END);
- const i64 size = ftell(f);
-
- // Reset the position to the position prior to calling f_get_sz
- fseek(f, pos, SEEK_SET);
-
- return size;
-}
-
Shader compile_shader(const char* file_path, const ShaderType shader_type) {
GLuint shaderID = 0;
GLenum shadertype = GL_INVALID_ENUM;