/* date = April 25th 2023 9:46 pm */

#ifndef OS_CORE_WIN32_H
#define OS_CORE_WIN32_H

// To avoid C4042 error when including windows we use some 
// preprocessor praga macro things.. So when including the windows headers we
// won't have defined the "function" keyword (we define it in base_core.h),
// and then we redefine it after when popping.
#pragma push_macro("function")
#undef function 
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma pop_macro("function")


// We have a nice debugbreak assert macro, but it is nice to have one also specifically for windows HRESULT
#define AssertHR(hr) Assert(SUCCEEDED(hr))

/////////////////////////////////////

// Processes and threads
typedef struct OS_W32_Thread OS_W32_Thread;
struct OS_W32_Thread
{
  OS_W32_Thread *next;
  HANDLE handle;
  DWORD thread_id;
  void *params;
  OS_Thread_Function *func;
};


/////////////////////////////////////
// Global state
typedef struct OS_W32_State OS_W32_State;
struct OS_W32_State
{
  Arena *arena;

  Arena *thread_arena;
  DWORD thread_context_index;
};

global HINSTANCE os_g_w32_hinstance;
global OS_W32_State *os_g_w32_state;

//root_function OS_W32_Window* OS_W32_window_from_handle(OS_Handle handle);
#endif //OS_CORE_WIN32_H
