mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Collision viewer UI Pass (#212)
* Initial Collision Viewer Issues: - UIWidget stuff was copied in to colViewer.cpp - Pause screen still renders collision. - Colour CVars are not working correctly. * Move collision viewer files and small adjustments * Redo collision viewer UI * use identity mtx * prevent draw collision on pause --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: Adam Bird <archez39@me.com>
This commit is contained in:
co-authored by
Kenix
Adam Bird
parent
17b698667f
commit
e0a1a430ae
@@ -35,6 +35,7 @@ namespace BenGui {
|
||||
std::shared_ptr<SaveEditorWindow> mSaveEditorWindow;
|
||||
std::shared_ptr<HudEditorWindow> mHudEditorWindow;
|
||||
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
||||
std::shared_ptr<CollisionViewerWindow> mCollisionViewerWindow;
|
||||
|
||||
void SetupGuiElements() {
|
||||
auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui();
|
||||
@@ -83,6 +84,9 @@ namespace BenGui {
|
||||
|
||||
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gWindows.ActorViewer", "Actor Viewer");
|
||||
gui->AddGuiWindow(mActorViewerWindow);
|
||||
|
||||
mCollisionViewerWindow = std::make_shared<CollisionViewerWindow>("gWindows.CollisionViewer", "Collision Viewer");
|
||||
gui->AddGuiWindow(mCollisionViewerWindow);
|
||||
}
|
||||
|
||||
void Destroy() {
|
||||
@@ -91,6 +95,7 @@ namespace BenGui {
|
||||
mConsoleWindow = nullptr;
|
||||
mInputEditorWindow = nullptr;
|
||||
mGfxDebuggerWindow = nullptr;
|
||||
mCollisionViewerWindow = nullptr;
|
||||
|
||||
mSaveEditorWindow = nullptr;
|
||||
mHudEditorWindow = nullptr;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "BenMenuBar.h"
|
||||
#include "DeveloperTools/SaveEditor.h"
|
||||
#include "DeveloperTools/ActorViewer.h"
|
||||
#include "DeveloperTools/CollisionViewer.h"
|
||||
|
||||
namespace BenGui {
|
||||
void SetupHooks();
|
||||
|
||||
@@ -328,6 +328,7 @@ extern std::shared_ptr<LUS::GuiWindow> mConsoleWindow;
|
||||
extern std::shared_ptr<LUS::GuiWindow> mGfxDebuggerWindow;
|
||||
extern std::shared_ptr<SaveEditorWindow> mSaveEditorWindow;
|
||||
extern std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
||||
extern std::shared_ptr<CollisionViewerWindow> mCollisionViewerWindow;
|
||||
|
||||
void DrawDeveloperToolsMenu() {
|
||||
if (UIWidgets::BeginMenu("Developer Tools", UIWidgets::Colors::Yellow)) {
|
||||
@@ -356,6 +357,10 @@ void DrawDeveloperToolsMenu() {
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
if (mCollisionViewerWindow) {
|
||||
UIWidgets::WindowButton("Collision Viewer", "gWindows.CollisionViewer", mCollisionViewerWindow,
|
||||
{ .tooltip = "Draws collision to the screen" });
|
||||
}
|
||||
if (mStatsWindow) {
|
||||
UIWidgets::WindowButton("Stats", "gWindows.Stats", mStatsWindow, {
|
||||
.tooltip = "Shows the stats window, with your FPS and frametimes, and the OS you're playing on"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "window/gui/GuiElement.h"
|
||||
#include "DeveloperTools/SaveEditor.h"
|
||||
#include "DeveloperTools/ActorViewer.h"
|
||||
#include "DeveloperTools/CollisionViewer.h"
|
||||
|
||||
namespace BenGui {
|
||||
class BenMenuBar : public LUS::GuiMenuBar {
|
||||
|
||||
@@ -394,6 +394,24 @@ namespace UIWidgets {
|
||||
return dirty;
|
||||
}
|
||||
|
||||
bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaultColor) {
|
||||
Color_RGBA8 color = CVarGetColor(cvarName, defaultColor);
|
||||
ImVec4 colorVec = ImVec4(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f);
|
||||
bool changed = false;
|
||||
PushStyleCombobox(Colors::Gray);
|
||||
if (ImGui::ColorEdit3(label, (float*)&colorVec, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoBorder)) {
|
||||
color.r = (uint8_t)(colorVec.x * 255.0f);
|
||||
color.g = (uint8_t)(colorVec.y * 255.0f);
|
||||
color.b = (uint8_t)(colorVec.z * 255.0f);
|
||||
color.a = (uint8_t)(colorVec.w * 255.0f);
|
||||
CVarSetColor(cvarName, color);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
changed = true;
|
||||
}
|
||||
PopStyleCombobox();
|
||||
return changed;
|
||||
}
|
||||
|
||||
void DrawFlagArray32(const std::string& name, uint32_t& flags) {
|
||||
ImGui::PushID(name.c_str());
|
||||
for (int32_t flagIndex = 0; flagIndex < 32; flagIndex++) {
|
||||
|
||||
@@ -409,6 +409,7 @@ namespace UIWidgets {
|
||||
bool CVarSliderInt(const char* label, const char* cvarName, int32_t min, int32_t max, const int32_t defaultValue, const IntSliderOptions& options = {});
|
||||
bool SliderFloat(const char* label, float* value, float min, float max, const FloatSliderOptions& options = {});
|
||||
bool CVarSliderFloat(const char* label, const char* cvarName, float min, float max, const float defaultValue, const FloatSliderOptions& options = {});
|
||||
bool CVarColorPicker(const char* label, const char* cvarName, Color_RGBA8 defaultColor);
|
||||
void DrawFlagArray32(const std::string& name, uint32_t& flags);
|
||||
void DrawFlagArray16(const std::string& name, uint16_t& flags);
|
||||
void DrawFlagArray8(const std::string& name, uint8_t& flags);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <libultraship/classes.h>
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void DrawCollisionViewer();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
class CollisionViewerWindow : public LUS::GuiWindow {
|
||||
public:
|
||||
using GuiWindow::GuiWindow;
|
||||
|
||||
void InitElement() override;
|
||||
void DrawElement() override;
|
||||
void UpdateElement() override {};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -35,6 +35,7 @@ u8 sMotionBlurStatus;
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
#include "debug.h"
|
||||
#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
|
||||
#include "2s2h/DeveloperTools/CollisionViewer.h"
|
||||
#include "2s2h/framebuffer_effects.h"
|
||||
#include <string.h>
|
||||
|
||||
@@ -1523,6 +1524,9 @@ void Play_DrawMain(PlayState* this) {
|
||||
}
|
||||
}
|
||||
|
||||
// Draw collision before the PostWorldDraw label so that collision is not drawn during pause
|
||||
DrawCollisionViewer();
|
||||
|
||||
PostWorldDraw:
|
||||
if (1) {
|
||||
Play_PostWorldDraw(this);
|
||||
|
||||
Reference in New Issue
Block a user