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 16, 2023
1 parent b01cf62 commit 7e107ca
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ jobs:

- name: Install Dependencies
if: matrix.config.name != 'WebAssembly'
run: conan install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=Release
run: conan install .. --output-folder=. --build="*" --settings compiler.cppstd=17 --settings build_type=Release
working-directory: build

- name: Install WebAssembly Dependencies
if: matrix.config.name == 'WebAssembly'
run: conan install .. --output-folder=. --build=missing --profile=webassembly --settings compiler.cppstd=20 --settings build_type=Release
run: conan install .. --output-folder=. --build="*" --profile=webassembly --settings compiler.cppstd=17 --settings build_type=Release
working-directory: build

- name: Configure
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endfunction()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_EXTENSIONS ON)
# set(CMAKE_CXX_EXTENSIONS ON)

set(SDL2_MAIN SDL2::SDL2main)

Expand Down
3 changes: 3 additions & 0 deletions assets/demo/scripts/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ me:on_update(function(self)

if engine:is_keydown(KeyEvent.d) then
self.x = self.x + 1
end

if engine:is_keydown(KeyEvent.space) then
me:play("blob/deitzis.ogg")
end

Expand Down
3 changes: 2 additions & 1 deletion src/event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ enum class keyevent : int32_t {
w = SDLK_w,
a = SDLK_a,
s = SDLK_s,
d = SDLK_d
d = SDLK_d,
space = SDLK_SPACE,
};

enum class mouseevent : int32_t {};
Expand Down
2 changes: 0 additions & 2 deletions src/eventmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class eventmanager : private noncopyable {

void remove_receiver(std::shared_ptr<eventreceiver> receiver);

// void add_listener(std::shared_pre<eventlistener> listener);
// void remove_listener(std::function<eventlistener> listener);
private:
std::list<std::shared_ptr<eventreceiver>> _receivers;
};
Expand Down
4 changes: 0 additions & 4 deletions src/eventreceiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@

class eventreceiver {
public:
eventreceiver() = default;
virtual ~eventreceiver() = default;

virtual void on_quit();

virtual void on_keydown(const keyevent &event);

virtual void on_keyup(const keyevent &event);

protected:
// std::shared_ptr<eventmanager> _eventmanager;
};

#endif
3 changes: 2 additions & 1 deletion src/scriptengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ void scriptengine::run() {
"w", keyevent::w,
"a", keyevent::a,
"s", keyevent::s,
"d", keyevent::d);
"d", keyevent::d,
"space", keyevent::space);

lua.new_usertype<point>(
"Point",
Expand Down

0 comments on commit 7e107ca

Please sign in to comment.