window_size_title_api #61

Merged
MartinFouilleul merged 8 commits from window_size_title_api into main 2023-08-25 13:29:28 +00:00
4 changed files with 51 additions and 1 deletions
Showing only changes of commit e4ac212408 - Show all commits

View File

@ -323,6 +323,8 @@ ORCA_API bool oc_window_is_hidden(oc_window window);
ORCA_API void oc_window_hide(oc_window window); ORCA_API void oc_window_hide(oc_window window);
ORCA_API void oc_window_show(oc_window window); ORCA_API void oc_window_show(oc_window window);
ORCA_API void oc_window_set_title(oc_window window, oc_str8 title);
ORCA_API bool oc_window_is_minimized(oc_window window); ORCA_API bool oc_window_is_minimized(oc_window window);
ORCA_API bool oc_window_is_maximized(oc_window window); ORCA_API bool oc_window_is_maximized(oc_window window);
ORCA_API void oc_window_minimize(oc_window window); ORCA_API void oc_window_minimize(oc_window window);
@ -403,6 +405,10 @@ ORCA_API int oc_directory_create(oc_str8 path);
void ORCA_IMPORT(oc_request_quit)(void); void ORCA_IMPORT(oc_request_quit)(void);
void ORCA_IMPORT(oc_runtime_window_set_title)(const char* title);
void ORCA_IMPORT(oc_runtime_window_set_size)(f32 width, f32 height);
#endif // !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA) #endif // !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -789,6 +789,20 @@ void oc_window_show(oc_window window)
} }
} }
void oc_window_set_title(oc_window window, oc_str8 title)
{
oc_window_data* windowData = oc_window_ptr_from_handle(window);
if(windowData)
{
oc_arena_scope scratch = oc_scratch_begin();
const char* titleCString = oc_str8_to_cstring(scratch.arena, title);
SetWindowText(windowData->win32.hWnd, titleCString);
oc_scratch_end(scratch);
}
}
bool oc_window_is_minimized(oc_window window) bool oc_window_is_minimized(oc_window window)
{ {
oc_window_data* windowData = oc_window_ptr_from_handle(window); oc_window_data* windowData = oc_window_ptr_from_handle(window);

View File

@ -66,6 +66,16 @@ oc_runtime_env* oc_runtime_env_get()
return (&__orcaApp.runtime); return (&__orcaApp.runtime);
} }
void oc_runtime_window_set_title(const char* title)
{
oc_window_set_title(__orcaApp.window, OC_STR8(title));
}
void oc_runtime_window_set_size(f32 width, f32 height)
{
oc_window_set_content_size(__orcaApp.window, (oc_vec2){ .x = width, .y = height });
}
void oc_runtime_log(oc_log_level level, void oc_runtime_log(oc_log_level level,
int fileLen, int fileLen,
char* file, char* file,

View File

@ -69,5 +69,25 @@
"cname": "oc_request_quit", "cname": "oc_request_quit",
"ret": {"name": "void", "tag": "v"}, "ret": {"name": "void", "tag": "v"},
"args": [] "args": []
},
{
"name": "oc_runtime_window_set_title",
"cname": "oc_runtime_window_set_title",
"ret": {"name": "void", "tag": "v"},
"args": [
{ "name": "title",
"type": {"name": "const char*", "tag": "p"}}
]
},
{
"name": "oc_runtime_window_set_size",
"cname": "oc_runtime_window_set_size",
"ret": {"name": "void", "tag": "v"},
"args": [
{ "name": "width",
"type": {"name": "f32", "tag": "f"}},
{ "name": "height",
"type": {"name": "f32", "tag": "f"}}
]
} }
] ]