large spatial / numerics refactor to allow double/integer vector types

This commit is contained in:
Noel Berry
2021-12-12 20:41:23 -08:00
parent 8f9c6aa9ff
commit d91658aa46
53 changed files with 1842 additions and 2056 deletions

View File

@ -1420,7 +1420,7 @@ namespace Blah
// Viewport
{
Rect viewport = pass.viewport;
Rectf viewport = pass.viewport;
viewport.y = size.y - viewport.y - viewport.h;
gl.Viewport((GLint)viewport.x, (GLint)viewport.y, (GLint)viewport.w, (GLint)viewport.h);
@ -1434,7 +1434,7 @@ namespace Blah
}
else
{
Rect scissor = pass.scissor;
Rectf scissor = pass.scissor;
scissor.y = size.y - scissor.y - scissor.h;
if (scissor.w < 0)

View File

@ -88,6 +88,12 @@ namespace Blah
// opens a directory in the OS file explorer / finder
void dir_explore(const char* path);
// sets the contents of the clipboard
void set_clipboard(const char* text);
// gets the contents of the clipboard into the given string
const char* get_clipboard();
// OpenGL Methods
void* gl_get_func(const char* name);
void* gl_context_create();

View File

@ -261,8 +261,8 @@ void Platform::update(InputState& state)
SDL_GetGlobalMouseState(&x, &y);
state.mouse.on_move(
Vec2((float)(x - win_x), (float)(y - win_y)),
Vec2((float)x, (float)y));
Vec2f((float)(x - win_x), (float)(y - win_y)),
Vec2f((float)x, (float)y));
}
// poll normal events
@ -722,6 +722,17 @@ void Platform::dir_explore(const char* path)
#endif
// clipboard
void Platform::set_clipboard(const char* text)
{
SDL_SetClipboardText(text);
}
const char* Platform::get_clipboard()
{
return SDL_GetClipboardText();
}
void* Platform::gl_get_func(const char* name)
{
return SDL_GL_GetProcAddress(name);

View File

@ -360,7 +360,7 @@ LRESULT CALLBACK Blah::win32_window_procedure(HWND hwnd, UINT msg, WPARAM wParam
return 0;
case WM_MOUSEMOVE:
g_platform.input_state->mouse.on_move(Vec2((float)((u16)lParam), (float)(lParam >> 16)), Vec2::zero);
g_platform.input_state->mouse.on_move(Vec2f((float)((u16)lParam), (float)(lParam >> 16)), Vec2f::zero);
return 0;
case WM_MOUSEWHEEL:
@ -628,6 +628,17 @@ FileRef Platform::file_open(const char* path, FileMode mode)
return FileRef(new Win32File(result));
}
// clipboard
void Platform::set_clipboard(const char* text)
{
BLAH_ASSERT(false, "Not Implemented Yet");
}
const char* Platform::get_clipboard()
{
BLAH_ASSERT(false, "Not Implemented Yet");
}
void* Platform::gl_get_func(const char* name)
{
// this check is taken from https://www.khronos.org/opengl/wiki/Load_OpenGL_Functions