-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing OIS with SDL input (using OGRE14 + Bites component) #2983
Draft
ohlidalp
wants to merge
12
commits into
RigsOfRods:master
Choose a base branch
from
ohlidalp:ogre13-sdl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open
I tried replacing our DearIMGUI integration (v 1.75 - very outdated) with OGRE's builtin DearImguiOverlay component. UPDATE: It's a success, just some finishing touches are needed, see below. Status:
|
ohlidalp
force-pushed
the
ogre13-sdl
branch
3 times, most recently
from
February 4, 2023 22:05
87aa958
to
7fbf49f
Compare
ohlidalp
referenced
this pull request
in ohlidalp/rigs-of-rods
Apr 11, 2023
Joint effort by @ohlidalp, @tritonas00, @AnotherFoxGuy, @CuriousMike56 ⬆️ Updated mygui, pagedgeometry and caelum 🐛 Fixed missing MyGUI shaders 🐛 Fixed MyGUI rendering issue 🔧 Build OGRE with resourcemanager_strict=off updated rtshader media 🐛 Fixed cmake not accepting `CMAKE_CONFIGURATION_TYPES` fixed odef lights scenenode 🐛 Fixed Caelum not loading os files Caelum time slider: restored original code (it works with latest Ogre master branch) 🐛 Fixed Imgui inverted colours on DirectX 9 fixed survey map texture updating ⬆️ Update OGRE to 13.5 updated rtshader media for Ogre 13.5 🔧 Implement PSSM3 properly ⬆️ Update OGRE to 13.5.1 Fixed crash on loading 2nd terrain w/envmap enabled ⬆️ Update OGRE to 13.5.3 Fixed crash on 2nd map load (procedural road material conflict) Media: fix corrupted DDS texture crashing under D3D9
Status: builds and runs OK, but there is no input. This is a brainless 1:1 replacement of OIS API and events with SDL API and OgreBites input events. I preserved our (very outdated) DearIMGUI integration. All our (quite convoluted) input processing stayed mostly intact. Only mouse/keyboard input is handled, joysticks + controllers + forcefeedback are temporarily disabled.
Status: build and runs, keyboard+mouse working, window is somehow oversized but responsive. Codechanges: * creating render window via OgreBites::ApplicationContext instead of OGRE Root directly - needed to receive events * overriding OgreBites::ApplicationContext::createRoot() with our pre-existing setup code, to initialize `mRoot` as expected. * calling `OgreBites::ApplicationContext::addInputListener()` to receive events.
STATUS: - ogre imgui port: keyboard/mouse input working! - ogre imgui port: FIXME: hacked Renderdash to build, but imgui will likely render into it - how to disable?? - ogre imgui port: builds and runs with default font. - under Debug I get asserts about NewFrame()/EndFrame() mismatches, to be fixed later. CODECHANGES: * imgui deprecated - renamed ImGui::AlignFirstTextHeightToWidgets() to ImGui::AlignTextToFramePadding() * imgui deprecated - ImGui::GetContentRegionAvailWidth() -> use ImGui::GetContentRegionAvail().x * imgui deprecated - GetWindowContentRegionWidth() function. -> 'GetWindowContentRegionMax().x * imgui deprecated - SetScrollHere() -> SetScrollHereX() + SetScollHereY() * imgui deprecated - ImGui::TreeAdvanceToLabelPos() -> use ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetTreeNodeToLabelSpacing()); * imgui deprecated - renamed SetNextTreeNodeOpen() to SetNextItemOpen(). * imgui deprecated - renamed ListBoxHeader(const char* label, ImVec2 size) to BeginListBox(). * imgui deprecated - removed BeginPopupContextWindow(const char*, int mouse_button, bool also_over_items) in favor of BeginPopupContextWindow(const char*, ImGuiPopupFlags flags) with ImGuiPopupFlags_NoOverItems. * imgui deprecated - removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges. * imgui deprecated - ImGuiCol_ChildWindowBg -> use ImGuiCol_ChildBg * imgui deprecated - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg * imgui deprecated - GetItemsLineHeightWithSpacing() -> use GetFrameHeightWithSpacing() * imgui deprecated - InputText: Renamed ImGuiTextEditCallbackData to ImGuiInputTextCallbackData * imgui deprecated - SetNextWindowContentWidth(float w) -> SetNextWindowContentSize(ImVec2(w, 0.0f)) * imgui deprecated - SetNextWindowPosCenter(ImGuiCond c=0) { SetNextWindowPos(GetMainViewport()->GetCenter(), c, ImVec2(0.5f,0.5f)); * ogre imgui port: use public `GetFont()/GetFontSize()` instead of internal `ImGuiContext->Font/FontSize` * VehicleAI panel: `Push/PopItemFlag(Disabled)` (imgui_internal) -> `Begin/EndDisabled()` (public BETA API)
…of screen. Deleted the windows-specific code setting ["monitorIndex"]- apparently OGRE does it by itself in `ApplicationContextSDL::createWindow()`, see OgreApplicationContextSDL.cpp line 56. Original commit: 128a8e2 - "Attempt to fix the 'Rendering Device' setting" - Ulteq, 4 years ago (29.12.2018 13:53:57) Also deleted setting ["windowProc"] - doesn't seem to have any effect, perhaps an OIS leftover.
Codechanges: * GUIUtils, InputEngine: `getModifierKeyName()` replaced OIS keycodes with OgreBites/SDL keycodes * ImGuiAngelscript: commented out some dead items, added (ImGuiKey) casts where needed, see ocornut/imgui#4921 * GUI_VehicleButtons: build fix for `ImGui::ImageButton()` - added parameter ID-string. * GUI_RepositorySelector: updated thumbnail downloading to use new OGRE WorkQueue API, see https://github.com/OGRECave/ogre/blob/master/Docs/14-Notes.md#task-based-workqueue * Application.h, main.cpp: added ✉️ `MSG_NET_DOWNLOAD_REPOTHUMB_SUCCESS`, used instead of OGRE WorkQueue's `addMainThreadTask` for consistency across the various background threads in the codebase. * GodRaysManager: build fix - RENDER_QUEUE_9 was removed from OGRE, using 8. * RttManager: rendersystem-specific `getProjectionMatrixRS()` was removed from OGRE, using portable `getProjectionMatrix()`
ohlidalp
force-pushed
the
ogre13-sdl
branch
from
September 22, 2023 00:08
c1a4c81
to
6e8f8cc
Compare
ohlidalp
changed the title
Replacing OIS with SDL input (using OGRE13 + Bites component)
Replacing OIS with SDL input (using OGRE14 + Bites component)
Sep 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a first step in migrating from self-shipped OIS library to standard SDL2 and OGRE's builtin DearIMGUI integration. I've based it on our (pretty mature already) OGRE13 port to get the latest tech and support.
Only mouse+keyboard are working, controllers and joysticks (+ force feedback) are temporarily disabled.
OGRE provides Bites component with generic ApplicationContext that runs on many platforms and powers OGRE SampleBrowser. It includes DearIMGUI integration, RTSS setup, window creation and generic input API for all devices. I tried replacing our OIS events + API calls 1:1 with Bites events and SDL API calls and it turns out to work just fine. I had to also replace the function which opens render window, as SDL input events don't work otherwise. Everything else remains unchanged. Also our (very outdated) DearIMGUI integration remains in place, with only updated input processing (based on OgreBites code, anyway).