Files
dusklight/src/dusk/ui/document.hpp
T
Irastris bd9b81f700 Add mouse input option for the third-person camera (#1011)
* Untie existing mouse logic from gyro

* A bit more mouse cleanup before I start building off it

* Rebase and last bit of cleanup

* Fix rebase mistake, don't apply invertFirstPerson to gyro or mouse input

* Remove the deprecated ImGui toast system

* Add Mouse Camera option in preparation for its use

* WIP, add mouse controls for the third-person camera

* Various helpText revisions

* Enable free camera on horseback

* Untie mouse camera and free camera options
Either being enabled now allows the underlying freecam logic to run

* Allow simultaneous C-stick and mouse input

* Combine mouse sensitivities for both aim and camera

* Add option for inverting mouse Y

* Refactor cursor visibility handling

* Tighten aim capture condition and constrain cursor to window region

* Tidying my trash

* Last bit of housekeeping so I'm satisfied

* Don't write code while sleep deprived

* Fix my sloppy merge and a few helpText updates

* Disable control stick aim when mouse aim is active

* Use same conditions for cursor grabbing as for capture
2026-06-01 23:37:53 -06:00

56 lines
1.4 KiB
C++

#pragma once
#include "component.hpp"
#include "ui.hpp"
namespace dusk::ui {
class Document {
public:
Document(const Rml::String& source);
virtual ~Document();
Document(const Document&) = delete;
Document& operator=(const Document&) = delete;
virtual void show();
virtual void hide(bool close);
virtual void update();
virtual bool focus();
virtual bool visible() const;
void listen(Rml::Element* element, Rml::EventId event, ScopedEventListener::Callback callback,
bool capture = false);
void listen(Rml::EventId event, ScopedEventListener::Callback callback, bool capture = false) {
listen(mDocument, event, std::move(callback), capture);
}
void toggle() {
if (visible()) {
hide(false);
} else {
show();
}
}
void push(std::unique_ptr<Document> document) {
push_document(std::move(document));
hide(false);
}
void pop() {
hide(true);
show_top_document();
}
bool pending_close() const { return mPendingClose; }
bool closed() const { return mClosed; }
protected:
virtual bool handle_nav_command(Rml::Event& event, NavCommand cmd);
Rml::ElementDocument* mDocument;
std::vector<std::unique_ptr<ScopedEventListener> > mListeners;
bool mPendingClose = false;
bool mClosed = false;
};
} // namespace dusk::ui