Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Jan 16, 2025
1 parent fdff61c commit 77336a2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ int32_t entity::y() const noexcept {
void entity::move(float_t x_velocity, float_t y_velocity) noexcept {
UNUSED(x_velocity);
UNUSED(y_velocity);
// cpBodySetVelocity(_props.body.get(), {x_velocity, y_velocity});
}

void entity::set_velocity(const algebra::vector2d &velocity) noexcept {
Expand Down
16 changes: 8 additions & 8 deletions src/eventmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
using namespace input;

eventmanager::eventmanager() {
// const auto number = SDL_NumJoysticks();
// for (auto id = 0; id < number; ++id) {
// if (SDL_IsGameController(id)) {
// if (auto controller = SDL_GameControllerOpen(id)) {
// _controllers.emplace(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller)), gamecontroller_ptr(controller));
// }
// }
// }
const auto number = SDL_NumJoysticks();
for (auto id = 0; id < number; ++id) {
if (SDL_IsGameController(id)) {
if (auto controller = SDL_GameControllerOpen(id)) {
_controllers.emplace(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller)), gamecontroller_ptr(controller));
}
}
}
}

void eventmanager::update(float_t delta) {
Expand Down
1 change: 1 addition & 0 deletions src/scriptengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ void framework::scriptengine::run() {

lua.new_usertype<framework::statemanager>(
"StateManager",
"players", sol::property(&statemanager::players),
"player", [&_p](framework::statemanager &self, input::player player) -> playerwrapper & {
auto [iterator, inserted] = _p.try_emplace(player, player, self);

Expand Down
4 changes: 4 additions & 0 deletions src/statemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ bool statemanager::on(int player, const std::variant<input::joystickevent> &type
return false;
}

int8_t statemanager::players() const noexcept {
return 0; // TODO
}

constexpr std::optional<input::joystickevent> keytoctrl(const input::keyevent &event) {
using namespace input;

Expand Down
3 changes: 2 additions & 1 deletion src/statemanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class statemanager : public input::eventreceiver {
statemanager() = default;
virtual ~statemanager() = default;

// bool is_keydown(const input::keyevent &event) const;
bool on(int player, const std::variant<input::joystickevent> &type) const noexcept;

int8_t players() const noexcept;

protected:
virtual void on_keydown(const input::keyevent &event) noexcept;

Expand Down

0 comments on commit 77336a2

Please sign in to comment.