Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Nov 1, 2023
1 parent 551d253 commit eeee03b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/motor.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#include "motor.hpp"

Check notice on line 1 in src/motor.cpp

View workflow job for this annotation

GitHub Actions / lint

Run clang-format on src/motor.cpp

File src/motor.cpp does not conform to Custom style guidelines. (lines 3, 6, 44, 45)

// std::shared_ptr<motor> motor::instance() {
// static std::shared_ptr<motor> instance(new motor());

// return instance;
// }
motor::motor() : _eventmanager(std::make_shared<eventmanager>()) {

Check warning on line 3 in src/motor.cpp

View workflow job for this annotation

GitHub Actions / lint

/src/motor.cpp:3:1 [cppcoreguidelines-pro-type-member-init]

constructor does not initialize these fields: _running, _loopables

Check warning on line 3 in src/motor.cpp

View workflow job for this annotation

GitHub Actions / lint

/src/motor.cpp:3:8 [modernize-use-equals-default]

use '= default' to define a trivial default constructor
}

void motor::init(std::string_view title, int32_t width, int32_t height, bool fullscreen) {
_running = true;
_window = std::make_shared<window>(title, width, height, fullscreen);
_renderer = _window->create_renderer();

_eventmanager = std::make_shared<eventmanager>();
_eventmanager->add_receiver(instance());

add_loopable(std::make_shared<framerate>());
Expand Down
1 change: 1 addition & 0 deletions src/motor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
class motor : public eventreceiver, public singleton<motor> {

Check warning on line 15 in src/motor.hpp

View workflow job for this annotation

GitHub Actions / lint

/src/motor.hpp:15:7 [cppcoreguidelines-special-member-functions]

class 'motor' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator
public:
virtual ~motor() = default;

Check warning on line 17 in src/motor.hpp

View workflow job for this annotation

GitHub Actions / lint

/src/motor.hpp:17:11 [modernize-use-override]

prefer using 'override' or (rarely) 'final' instead of 'virtual'
motor();

// static std::shared_ptr<motor> instance();

Expand Down
4 changes: 1 addition & 3 deletions src/scriptengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void scriptengine::run() {
_lua.set_function("is_keydown", &statemanager::is_keydown, sm);

const auto m = motor::instance();
// m->get_eventmanager()->add_receiver(sm);
m->get_eventmanager()->add_receiver(sm);

_lua.new_usertype<motor>("motor",
"new", sol::factories(&motor::instance),
Expand All @@ -40,8 +40,6 @@ void scriptengine::run() {
local motor = motor.new()
motor:init("Carimbo", 800, 600, false)
print(is_keydown(keyevent.a))
motor:run()
)";

Expand Down

0 comments on commit eeee03b

Please sign in to comment.