mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
Cleanup.
This commit is contained in:
parent
cf6bcfa307
commit
a2716a3fe6
2 changed files with 39 additions and 28 deletions
|
@ -29,7 +29,6 @@
|
|||
#include <bx/fpumath.h>
|
||||
#include <bx/handlealloc.h>
|
||||
|
||||
#include "../entry/dbg.h"
|
||||
#include "imgui.h"
|
||||
#include "ocornut_imgui.h"
|
||||
#include "../nanovg/nanovg.h"
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
#include "imgui.h"
|
||||
#include "ocornut_imgui.h"
|
||||
#include <stb/stb_image.c>
|
||||
|
||||
#if defined(SCI_NAMESPACE)
|
||||
# include "../entry/input.h"
|
||||
#endif // defined(SCI_NAMESPACE)
|
||||
|
||||
#include "vs_ocornut_imgui.bin.h"
|
||||
#include "fs_ocornut_imgui.bin.h"
|
||||
|
@ -112,6 +115,7 @@ struct OcornutImguiContext
|
|||
io.IniFilename = NULL;
|
||||
io.PixelCenterOffset = bgfx::RendererType::Direct3D9 == bgfx::getRendererType() ? 0.0f : 0.5f;
|
||||
|
||||
#if defined(SCI_NAMESPACE)
|
||||
io.KeyMap[ImGuiKey_Tab] = (int)entry::Key::Tab;
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = (int)entry::Key::Left;
|
||||
io.KeyMap[ImGuiKey_RightArrow] = (int)entry::Key::Right;
|
||||
|
@ -129,6 +133,7 @@ struct OcornutImguiContext
|
|||
io.KeyMap[ImGuiKey_X] = (int)entry::Key::KeyX;
|
||||
io.KeyMap[ImGuiKey_Y] = (int)entry::Key::KeyY;
|
||||
io.KeyMap[ImGuiKey_Z] = (int)entry::Key::KeyZ;
|
||||
#endif // defined(SCI_NAMESPACE)
|
||||
|
||||
const bgfx::Memory* vsmem;
|
||||
const bgfx::Memory* fsmem;
|
||||
|
@ -202,7 +207,10 @@ struct OcornutImguiContext
|
|||
m_viewId = _viewId;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (_inputChar < 0x7f)
|
||||
{
|
||||
io.AddInputCharacter(_inputChar); // ASCII or GTFO! :(
|
||||
}
|
||||
|
||||
io.DisplaySize = ImVec2((float)_width, (float)_height);
|
||||
io.DeltaTime = 1.0f / 60.0f;
|
||||
io.MousePos = ImVec2((float)_mx, (float)_my);
|
||||
|
@ -211,12 +219,16 @@ struct OcornutImguiContext
|
|||
io.MouseWheel = (float)(_scroll - m_lastScroll);
|
||||
m_lastScroll = _scroll;
|
||||
|
||||
#if defined(SCI_NAMESPACE)
|
||||
uint8_t modifiers = inputGetModifiersState();
|
||||
io.KeyShift = 0 != (modifiers & (entry::Modifier::LeftShift | entry::Modifier::RightShift) );
|
||||
io.KeyCtrl = 0 != (modifiers & (entry::Modifier::LeftCtrl | entry::Modifier::RightCtrl ) );
|
||||
io.KeyAlt = 0 != (modifiers & (entry::Modifier::LeftAlt | entry::Modifier::RightAlt ) );
|
||||
for (int32_t ii = 0; ii < (int32_t)entry::Key::Count; ++ii)
|
||||
io.KeysDown[ii] = inputGetKeyState((entry::Key::Enum)ii);
|
||||
{
|
||||
io.KeysDown[ii] = inputGetKeyState(entry::Key::Enum(ii) );
|
||||
}
|
||||
#endif // defined(SCI_NAMESPACE)
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
|
|
Loading…
Reference in a new issue