mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 13:59:19 +02:00
build 180804. configurable command bindings for scroll wheel, minor bug fixes
This commit is contained in:
@@ -141,6 +141,7 @@ eu07_application::run() {
|
|||||||
&& ( true == m_modes[ m_modestack.top() ]->update() )
|
&& ( true == m_modes[ m_modestack.top() ]->update() )
|
||||||
&& ( true == GfxRenderer.Render() ) ) {
|
&& ( true == GfxRenderer.Render() ) ) {
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
m_modes[ m_modestack.top() ]->on_event_poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public:
|
|||||||
virtual
|
virtual
|
||||||
void
|
void
|
||||||
on_scroll( double const Xoffset, double const Yoffset ) = 0;
|
on_scroll( double const Xoffset, double const Yoffset ) = 0;
|
||||||
|
virtual
|
||||||
|
void
|
||||||
|
on_event_poll() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// members
|
// members
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ bool
|
|||||||
driverkeyboard_input::init() {
|
driverkeyboard_input::init() {
|
||||||
|
|
||||||
default_bindings();
|
default_bindings();
|
||||||
|
recall_bindings();
|
||||||
|
bind();
|
||||||
|
|
||||||
return recall_bindings();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -59,7 +61,7 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
|
{ user_command::manualbrakedecrease, GLFW_KEY_KP_7 | keymodifier::control },
|
||||||
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
|
{ user_command::alarmchaintoggle, GLFW_KEY_B | keymodifier::shift | keymodifier::control },
|
||||||
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
|
{ user_command::wheelspinbrakeactivate, GLFW_KEY_KP_ENTER },
|
||||||
{ user_command::sandboxactivate, GLFW_KEY_S },
|
{ user_command::sandboxactivate, GLFW_KEY_S | keymodifier::shift },
|
||||||
{ user_command::reverserincrease, GLFW_KEY_D },
|
{ user_command::reverserincrease, GLFW_KEY_D },
|
||||||
{ user_command::reverserdecrease, GLFW_KEY_R },
|
{ user_command::reverserdecrease, GLFW_KEY_R },
|
||||||
// reverserforwardhigh,
|
// reverserforwardhigh,
|
||||||
@@ -99,7 +101,7 @@ driverkeyboard_input::default_bindings() {
|
|||||||
// compressorenable,
|
// compressorenable,
|
||||||
// compressordisable,
|
// compressordisable,
|
||||||
{ user_command::compressortogglelocal, GLFW_KEY_C | keymodifier::shift },
|
{ user_command::compressortogglelocal, GLFW_KEY_C | keymodifier::shift },
|
||||||
{ user_command::motoroverloadrelaythresholdtoggle, GLFW_KEY_F },
|
{ user_command::motoroverloadrelaythresholdtoggle, GLFW_KEY_F | keymodifier::control },
|
||||||
// motoroverloadrelaythresholdsetlow,
|
// motoroverloadrelaythresholdsetlow,
|
||||||
// motoroverloadrelaythresholdsethigh,
|
// motoroverloadrelaythresholdsethigh,
|
||||||
{ user_command::motoroverloadrelayreset, GLFW_KEY_N },
|
{ user_command::motoroverloadrelayreset, GLFW_KEY_N },
|
||||||
@@ -142,7 +144,7 @@ driverkeyboard_input::default_bindings() {
|
|||||||
{ user_command::doortoggleleft, GLFW_KEY_COMMA },
|
{ user_command::doortoggleleft, GLFW_KEY_COMMA },
|
||||||
{ user_command::doortoggleright, GLFW_KEY_PERIOD },
|
{ user_command::doortoggleright, GLFW_KEY_PERIOD },
|
||||||
{ user_command::departureannounce, GLFW_KEY_SLASH },
|
{ user_command::departureannounce, GLFW_KEY_SLASH },
|
||||||
{ user_command::doorlocktoggle, GLFW_KEY_S | keymodifier::shift },
|
{ user_command::doorlocktoggle, GLFW_KEY_S | keymodifier::control },
|
||||||
{ user_command::pantographcompressorvalvetoggle, GLFW_KEY_V | keymodifier::control },
|
{ user_command::pantographcompressorvalvetoggle, GLFW_KEY_V | keymodifier::control },
|
||||||
{ user_command::pantographcompressoractivate, GLFW_KEY_V | keymodifier::shift },
|
{ user_command::pantographcompressoractivate, GLFW_KEY_V | keymodifier::shift },
|
||||||
{ user_command::pantographtogglefront, GLFW_KEY_P },
|
{ user_command::pantographtogglefront, GLFW_KEY_P },
|
||||||
@@ -208,8 +210,6 @@ driverkeyboard_input::default_bindings() {
|
|||||||
// batteryenable,
|
// batteryenable,
|
||||||
// batterydisable,
|
// batterydisable,
|
||||||
};
|
};
|
||||||
|
|
||||||
bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ driver_mode::drivermode_input::init() {
|
|||||||
// initialize input devices
|
// initialize input devices
|
||||||
auto result = (
|
auto result = (
|
||||||
keyboard.init()
|
keyboard.init()
|
||||||
&& mouse.init()
|
&& mouse.init() );
|
||||||
&& gamepad.init() );
|
if( true == Global.InputGamepad ) {
|
||||||
|
gamepad.init();
|
||||||
|
}
|
||||||
if( true == Global.uart_conf.enable ) {
|
if( true == Global.uart_conf.enable ) {
|
||||||
uart = std::make_unique<uart_input>();
|
uart = std::make_unique<uart_input>();
|
||||||
result = ( result && uart->init() );
|
uart->init();
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Console::On(); // włączenie konsoli
|
Console::On(); // włączenie konsoli
|
||||||
@@ -231,8 +233,6 @@ driver_mode::update() {
|
|||||||
|
|
||||||
simulation::is_ready = true;
|
simulation::is_ready = true;
|
||||||
|
|
||||||
m_input.poll();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,10 +381,13 @@ driver_mode::on_mouse_button( int const Button, int const Action, int const Mods
|
|||||||
void
|
void
|
||||||
driver_mode::on_scroll( double const Xoffset, double const Yoffset ) {
|
driver_mode::on_scroll( double const Xoffset, double const Yoffset ) {
|
||||||
|
|
||||||
if( Global.ctrlState ) {
|
m_input.mouse.scroll( Xoffset, Yoffset );
|
||||||
// ctrl + scroll wheel adjusts fov
|
}
|
||||||
Global.FieldOfView = clamp( static_cast<float>( Global.FieldOfView - Yoffset * 20.0 / Timer::subsystem.gfx_total.average() ), 15.0f, 75.0f );
|
|
||||||
}
|
void
|
||||||
|
driver_mode::on_event_poll() {
|
||||||
|
|
||||||
|
m_input.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -47,13 +47,15 @@ public:
|
|||||||
on_mouse_button( int const Button, int const Action, int const Mods ) override;
|
on_mouse_button( int const Button, int const Action, int const Mods ) override;
|
||||||
void
|
void
|
||||||
on_scroll( double const Xoffset, double const Yoffset ) override;
|
on_scroll( double const Xoffset, double const Yoffset ) override;
|
||||||
|
void
|
||||||
|
on_event_poll() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// types
|
// types
|
||||||
struct drivermode_input {
|
struct drivermode_input {
|
||||||
|
|
||||||
gamepad_input gamepad;
|
gamepad_input gamepad;
|
||||||
mouse_input mouse;
|
drivermouse_input mouse;
|
||||||
glm::dvec2 mouse_pickmodepos; // stores last mouse position in control picking mode
|
glm::dvec2 mouse_pickmodepos; // stores last mouse position in control picking mode
|
||||||
driverkeyboard_input keyboard;
|
driverkeyboard_input keyboard;
|
||||||
Console console;
|
Console console;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "animmodel.h"
|
#include "animmodel.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include "uilayer.h"
|
#include "uilayer.h"
|
||||||
|
#include "logs.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
mouse_slider::bind( user_command const &Command ) {
|
mouse_slider::bind( user_command const &Command ) {
|
||||||
@@ -121,7 +122,7 @@ mouse_slider::on_move( double const Mousex, double const Mousey ) {
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
mouse_input::init() {
|
drivermouse_input::init() {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD systemkeyboardspeed;
|
DWORD systemkeyboardspeed;
|
||||||
@@ -131,11 +132,75 @@ mouse_input::init() {
|
|||||||
::SystemParametersInfo( SPI_GETKEYBOARDDELAY, 0, &systemkeyboarddelay, 0 );
|
::SystemParametersInfo( SPI_GETKEYBOARDDELAY, 0, &systemkeyboarddelay, 0 );
|
||||||
m_updatedelay = interpolate( 0.25, 1.0, systemkeyboarddelay / 3.0 );
|
m_updatedelay = interpolate( 0.25, 1.0, systemkeyboarddelay / 3.0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
default_bindings();
|
||||||
|
recall_bindings();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
drivermouse_input::recall_bindings() {
|
||||||
|
|
||||||
|
cParser bindingparser( "eu07_input-mouse.ini", cParser::buffer_FILE );
|
||||||
|
if( false == bindingparser.ok() ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// build helper translation tables
|
||||||
|
std::unordered_map<std::string, user_command> nametocommandmap;
|
||||||
|
std::size_t commandid = 0;
|
||||||
|
for( auto const &description : simulation::Commands_descriptions ) {
|
||||||
|
nametocommandmap.emplace(
|
||||||
|
description.name,
|
||||||
|
static_cast<user_command>( commandid ) );
|
||||||
|
++commandid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: to simplify things we expect one entry per line, and whole entry in one line
|
||||||
|
while( true == bindingparser.getTokens( 1, true, "\n" ) ) {
|
||||||
|
|
||||||
|
std::string bindingentry;
|
||||||
|
bindingparser >> bindingentry;
|
||||||
|
cParser entryparser( bindingentry );
|
||||||
|
|
||||||
|
if( true == entryparser.getTokens( 1, true, "\n\r\t " ) ) {
|
||||||
|
|
||||||
|
std::string bindingpoint {};
|
||||||
|
entryparser >> bindingpoint;
|
||||||
|
|
||||||
|
std::vector< std::reference_wrapper<user_command> > bindingtargets;
|
||||||
|
|
||||||
|
if( bindingpoint == "wheel" ) {
|
||||||
|
bindingtargets.emplace_back( std::ref( m_wheelbindings.up ) );
|
||||||
|
bindingtargets.emplace_back( std::ref( m_wheelbindings.down ) );
|
||||||
|
}
|
||||||
|
// TODO: binding targets for mouse buttons
|
||||||
|
|
||||||
|
for( auto &bindingtarget : bindingtargets ) {
|
||||||
|
// grab command(s) associated with the input pin
|
||||||
|
auto const bindingcommandname{ entryparser.getToken<std::string>() };
|
||||||
|
if( true == bindingcommandname.empty() ) {
|
||||||
|
// no tokens left, may as well complain then call it a day
|
||||||
|
WriteLog( "Mouse binding for " + bindingpoint + " didn't specify associated command(s)" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
auto const commandlookup = nametocommandmap.find( bindingcommandname );
|
||||||
|
if( commandlookup == nametocommandmap.end() ) {
|
||||||
|
WriteLog( "Mouse binding for " + bindingpoint + " specified unknown command, \"" + bindingcommandname + "\"" );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bindingtarget.get() = commandlookup->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mouse_input::move( double Mousex, double Mousey ) {
|
drivermouse_input::move( double Mousex, double Mousey ) {
|
||||||
|
|
||||||
if( false == Global.ControlPicking ) {
|
if( false == Global.ControlPicking ) {
|
||||||
// default control mode
|
// default control mode
|
||||||
@@ -182,7 +247,33 @@ mouse_input::move( double Mousex, double Mousey ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mouse_input::button( int const Button, int const Action ) {
|
drivermouse_input::scroll( double const Xoffset, double const Yoffset ) {
|
||||||
|
|
||||||
|
if( Global.ctrlState ) {
|
||||||
|
// ctrl + scroll wheel adjusts fov
|
||||||
|
Global.FieldOfView = clamp( static_cast<float>( Global.FieldOfView - Yoffset * 20.0 / Timer::subsystem.gfx_total.average() ), 15.0f, 75.0f );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// scroll adjusts master controller
|
||||||
|
// TODO: allow configurable scroll commands
|
||||||
|
auto command {
|
||||||
|
adjust_command(
|
||||||
|
( Yoffset > 0.0 ) ?
|
||||||
|
m_wheelbindings.up :
|
||||||
|
m_wheelbindings.down ) };
|
||||||
|
|
||||||
|
m_relay.post(
|
||||||
|
command,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
GLFW_PRESS,
|
||||||
|
// TODO: pass correct entity id once the missing systems are in place
|
||||||
|
0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drivermouse_input::button( int const Button, int const Action ) {
|
||||||
|
|
||||||
// store key state
|
// store key state
|
||||||
if( Button >= 0 ) {
|
if( Button >= 0 ) {
|
||||||
@@ -241,8 +332,8 @@ mouse_input::button( int const Button, int const Action ) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if not release then it's press
|
// if not release then it's press
|
||||||
auto const lookup = m_mousecommands.find( simulation::Train->GetLabel( GfxRenderer.Update_Pick_Control() ) );
|
auto const lookup = m_buttonbindings.find( simulation::Train->GetLabel( GfxRenderer.Update_Pick_Control() ) );
|
||||||
if( lookup != m_mousecommands.end() ) {
|
if( lookup != m_buttonbindings.end() ) {
|
||||||
// if the recognized element under the cursor has a command associated with the pressed button, notify the recipient
|
// if the recognized element under the cursor has a command associated with the pressed button, notify the recipient
|
||||||
mousecommand = (
|
mousecommand = (
|
||||||
Button == GLFW_MOUSE_BUTTON_LEFT ?
|
Button == GLFW_MOUSE_BUTTON_LEFT ?
|
||||||
@@ -307,13 +398,13 @@ mouse_input::button( int const Button, int const Action ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
mouse_input::button( int const Button ) const {
|
drivermouse_input::button( int const Button ) const {
|
||||||
|
|
||||||
return m_buttons[ Button ];
|
return m_buttons[ Button ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mouse_input::poll() {
|
drivermouse_input::poll() {
|
||||||
|
|
||||||
m_updateaccumulator += Timer::GetDeltaRenderTime();
|
m_updateaccumulator += Timer::GetDeltaRenderTime();
|
||||||
|
|
||||||
@@ -341,7 +432,7 @@ mouse_input::poll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
user_command
|
user_command
|
||||||
mouse_input::command() const {
|
drivermouse_input::command() const {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
m_slider.command() != user_command::none ? m_slider.command() :
|
m_slider.command() != user_command::none ? m_slider.command() :
|
||||||
@@ -350,9 +441,9 @@ mouse_input::command() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mouse_input::default_bindings() {
|
drivermouse_input::default_bindings() {
|
||||||
|
|
||||||
m_mousecommands = {
|
m_buttonbindings = {
|
||||||
{ "mainctrl:", {
|
{ "mainctrl:", {
|
||||||
user_command::mastercontrollerset,
|
user_command::mastercontrollerset,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
@@ -612,4 +703,23 @@ mouse_input::default_bindings() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user_command
|
||||||
|
drivermouse_input::adjust_command( user_command Command ) {
|
||||||
|
|
||||||
|
if( ( true == Global.shiftState )
|
||||||
|
&& ( Command != user_command::none ) ) {
|
||||||
|
switch( Command ) {
|
||||||
|
case user_command::mastercontrollerincrease: { Command = user_command::mastercontrollerincreasefast; break; }
|
||||||
|
case user_command::mastercontrollerdecrease: { Command = user_command::mastercontrollerdecreasefast; break; }
|
||||||
|
case user_command::secondcontrollerincrease: { Command = user_command::secondcontrollerincreasefast; break; }
|
||||||
|
case user_command::secondcontrollerdecrease: { Command = user_command::secondcontrollerdecreasefast; break; }
|
||||||
|
case user_command::independentbrakeincrease: { Command = user_command::independentbrakeincreasefast; break; }
|
||||||
|
case user_command::independentbrakedecrease: { Command = user_command::independentbrakedecreasefast; break; }
|
||||||
|
default: { break; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Command;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -42,21 +42,25 @@ private:
|
|||||||
glm::dvec2 m_cursorposition { 0.0 };
|
glm::dvec2 m_cursorposition { 0.0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class mouse_input {
|
class drivermouse_input {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// constructors
|
// constructors
|
||||||
mouse_input() { default_bindings(); }
|
drivermouse_input() = default;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool
|
bool
|
||||||
init();
|
init();
|
||||||
|
bool
|
||||||
|
recall_bindings();
|
||||||
void
|
void
|
||||||
button( int const Button, int const Action );
|
button( int const Button, int const Action );
|
||||||
int
|
int
|
||||||
button( int const Button ) const;
|
button( int const Button ) const;
|
||||||
void
|
void
|
||||||
move( double const Mousex, double const Mousey );
|
move( double const Horizontal, double const Vertical );
|
||||||
|
void
|
||||||
|
scroll( double const Xoffset, double const Yoffset );
|
||||||
void
|
void
|
||||||
poll();
|
poll();
|
||||||
user_command
|
user_command
|
||||||
@@ -64,22 +68,32 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// types
|
// types
|
||||||
struct mouse_commands {
|
struct button_bindings {
|
||||||
|
|
||||||
user_command left;
|
user_command left;
|
||||||
user_command right;
|
user_command right;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::unordered_map<std::string, mouse_commands> controlcommands_map;
|
struct wheel_bindings {
|
||||||
|
|
||||||
|
user_command up;
|
||||||
|
user_command down;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<std::string, button_bindings> buttonbindings_map;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void
|
void
|
||||||
default_bindings();
|
default_bindings();
|
||||||
|
// potentially replaces supplied command with a more relevant one
|
||||||
|
user_command
|
||||||
|
adjust_command( user_command Command );
|
||||||
|
|
||||||
// members
|
// members
|
||||||
command_relay m_relay;
|
command_relay m_relay;
|
||||||
mouse_slider m_slider; // virtual control, when active translates intercepted mouse position to a value
|
mouse_slider m_slider; // virtual control, when active translates intercepted mouse position to a value
|
||||||
controlcommands_map m_mousecommands;
|
buttonbindings_map m_buttonbindings;
|
||||||
|
wheel_bindings m_wheelbindings { user_command::mastercontrollerincrease, user_command::mastercontrollerdecrease }; // commands bound to the scroll wheel
|
||||||
user_command m_mousecommandleft { user_command::none }; // last if any command issued with left mouse button
|
user_command m_mousecommandleft { user_command::none }; // last if any command issued with left mouse button
|
||||||
user_command m_mousecommandright { user_command::none }; // last if any command issued with right mouse button
|
user_command m_mousecommandright { user_command::none }; // last if any command issued with right mouse button
|
||||||
double m_updaterate { 0.075 };
|
double m_updaterate { 0.075 };
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ editorkeyboard_input::init() {
|
|||||||
default_bindings();
|
default_bindings();
|
||||||
// TODO: re-enable after mode-specific binding import is in place
|
// TODO: re-enable after mode-specific binding import is in place
|
||||||
// return recall_bindings();
|
// return recall_bindings();
|
||||||
|
bind();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,8 +31,6 @@ editorkeyboard_input::default_bindings() {
|
|||||||
{ user_command::moveup, GLFW_KEY_PAGE_UP },
|
{ user_command::moveup, GLFW_KEY_PAGE_UP },
|
||||||
{ user_command::movedown, GLFW_KEY_PAGE_DOWN },
|
{ user_command::movedown, GLFW_KEY_PAGE_DOWN },
|
||||||
};
|
};
|
||||||
|
|
||||||
bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -87,8 +87,6 @@ editor_mode::update() {
|
|||||||
|
|
||||||
simulation::is_ready = true;
|
simulation::is_ready = true;
|
||||||
|
|
||||||
m_input.poll();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,6 +248,12 @@ editor_mode::on_mouse_button( int const Button, int const Action, int const Mods
|
|||||||
m_input.mouse.button( Button, Action );
|
m_input.mouse.button( Button, Action );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
editor_mode::on_event_poll() {
|
||||||
|
|
||||||
|
m_input.poll();
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
editor_mode::mode_translation() const {
|
editor_mode::mode_translation() const {
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public:
|
|||||||
on_mouse_button( int const Button, int const Action, int const Mods ) override;
|
on_mouse_button( int const Button, int const Action, int const Mods ) override;
|
||||||
void
|
void
|
||||||
on_scroll( double const Xoffset, double const Yoffset ) override { ; }
|
on_scroll( double const Xoffset, double const Yoffset ) override { ; }
|
||||||
|
void
|
||||||
|
on_event_poll() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// types
|
// types
|
||||||
|
|||||||
@@ -110,8 +110,6 @@ keyboard_input::recall_bindings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bind();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,15 +185,9 @@ keyboard_input::key( int const Key ) const {
|
|||||||
void
|
void
|
||||||
keyboard_input::bind() {
|
keyboard_input::bind() {
|
||||||
|
|
||||||
m_bindings.clear();
|
|
||||||
|
|
||||||
for( auto const &bindingsetup : m_bindingsetups ) {
|
for( auto const &bindingsetup : m_bindingsetups ) {
|
||||||
|
|
||||||
if( bindingsetup.binding != -1 ) {
|
m_bindings[ bindingsetup.binding ] = bindingsetup.command;
|
||||||
m_bindings.emplace(
|
|
||||||
bindingsetup.binding,
|
|
||||||
bindingsetup.command );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// cache movement key bindings
|
// cache movement key bindings
|
||||||
m_bindingscache.forward = binding( user_command::moveforward );
|
m_bindingscache.forward = binding( user_command::moveforward );
|
||||||
|
|||||||
@@ -38,4 +38,6 @@ public:
|
|||||||
on_mouse_button( int const Button, int const Action, int const Mods ) override { ; }
|
on_mouse_button( int const Button, int const Action, int const Mods ) override { ; }
|
||||||
void
|
void
|
||||||
on_scroll( double const Xoffset, double const Yoffset ) override { ; }
|
on_scroll( double const Xoffset, double const Yoffset ) override { ; }
|
||||||
|
void
|
||||||
|
on_event_poll() override { ; }
|
||||||
};
|
};
|
||||||
|
|||||||
3
scene.h
3
scene.h
@@ -172,8 +172,7 @@ private:
|
|||||||
enclose_area( scene::basic_node *Node );
|
enclose_area( scene::basic_node *Node );
|
||||||
// members
|
// members
|
||||||
scene::bounding_area m_area { glm::dvec3(), static_cast<float>( 0.5 * M_SQRT2 * EU07_CELLSIZE ) };
|
scene::bounding_area m_area { glm::dvec3(), static_cast<float>( 0.5 * M_SQRT2 * EU07_CELLSIZE ) };
|
||||||
bool m_active { false }; // whether the cell holds any actual data
|
bool m_active { false }; // whether the cell holds any actual data content
|
||||||
// content
|
|
||||||
shapenode_sequence m_shapesopaque; // opaque pieces of geometry
|
shapenode_sequence m_shapesopaque; // opaque pieces of geometry
|
||||||
shapenode_sequence m_shapestranslucent; // translucent pieces of geometry
|
shapenode_sequence m_shapestranslucent; // translucent pieces of geometry
|
||||||
linesnode_sequence m_lines;
|
linesnode_sequence m_lines;
|
||||||
|
|||||||
Reference in New Issue
Block a user