mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-20 23:23:30 +02:00
feat(editor): scripted mouse and keys for the self-tests and the launcher: mouse, mouseat, glide, button, wheel, press, release, tap, type and softcursor drive the window as the user does, EU07_LAUNCHER_SELFTEST runs a script in the launcher and the scenery wizard and hands an editor script on with editorscript; selectat selects the path nearest a point, switchlink no longer takes over a crossover left in the tool, joints without points logs every issue with free ends
This commit is contained in:
49
application/scriptedinput.h
Normal file
49
application/scriptedinput.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class scripted_input
|
||||
{
|
||||
public:
|
||||
bool dispatch(std::string const &Command, std::istringstream &Words);
|
||||
void mouse_to(glm::dvec2 const &Screen);
|
||||
std::optional<glm::dvec2> const &mouse() const
|
||||
{
|
||||
return m_mouse;
|
||||
}
|
||||
|
||||
private:
|
||||
void modifiers() const;
|
||||
std::optional<glm::dvec2> m_mouse;
|
||||
int m_mods{0};
|
||||
};
|
||||
|
||||
class input_script
|
||||
{
|
||||
public:
|
||||
explicit input_script(char const *Variable) : m_variable{Variable} {}
|
||||
void step();
|
||||
|
||||
private:
|
||||
char const *m_variable;
|
||||
bool m_loaded{false};
|
||||
std::vector<std::string> m_lines;
|
||||
std::size_t m_next{0};
|
||||
int m_wait{0};
|
||||
bool m_quitting{false};
|
||||
scripted_input m_input;
|
||||
};
|
||||
Reference in New Issue
Block a user