mirror of
https://github.com/NoelFB/tiny_link.git
synced 2024-11-25 18:18:56 +08:00
Emscripten build
This commit is contained in:
parent
f8254013c3
commit
7ffa649160
|
@ -44,6 +44,11 @@ add_executable(game
|
|||
# Reference blah
|
||||
target_link_libraries(game blah)
|
||||
|
||||
if( ${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
|
||||
set_target_properties(game PROPERTIES LINK_FLAGS "-s USE_SDL=2 -s USE_WEBGL2=1 --preload-file ${CMAKE_SOURCE_DIR}/content@/content")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".html")
|
||||
endif()
|
||||
|
||||
# copy SDL2 to the build directory
|
||||
set(SDL2_DLL "" CACHE FILEPATH "SDL2 DLL Path")
|
||||
if (SDL2_ENABLED)
|
||||
|
|
|
@ -23,9 +23,7 @@ Collider Collider::make_grid(int tile_size, int columns, int rows)
|
|||
collider.m_grid.tile_size = tile_size;
|
||||
collider.m_grid.columns = columns;
|
||||
collider.m_grid.rows = rows;
|
||||
collider.m_grid.cells = std::shared_ptr<bool[]>(new bool[columns * rows]);
|
||||
|
||||
memset(collider.m_grid.cells.get(), 0, sizeof(bool) * columns * rows);
|
||||
collider.m_grid.cells.resize(columns * rows);
|
||||
|
||||
return collider;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include <blah.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "../world.h"
|
||||
|
||||
using namespace Blah;
|
||||
|
@ -44,7 +45,7 @@ namespace TL
|
|||
int columns;
|
||||
int rows;
|
||||
int tile_size;
|
||||
std::shared_ptr<bool[]> cells;
|
||||
std::vector<bool> cells;
|
||||
};
|
||||
|
||||
Shape m_shape = Shape::None;
|
||||
|
|
|
@ -28,6 +28,7 @@ bool Mover::move_x(int amount)
|
|||
{
|
||||
entity()->position.x += amount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Mover::move_y(int amount)
|
||||
|
@ -64,6 +65,7 @@ bool Mover::move_y(int amount)
|
|||
{
|
||||
entity()->position.y += amount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Mover::stop_x()
|
||||
|
|
|
@ -12,7 +12,7 @@ Tilemap::Tilemap(int tile_width, int tile_height, int columns, int rows)
|
|||
m_tile_height = tile_height;
|
||||
m_columns = columns;
|
||||
m_rows = rows;
|
||||
m_grid = std::shared_ptr<Subtexture[]>(new Subtexture[columns * rows]);
|
||||
m_grid.resize(columns * rows);
|
||||
}
|
||||
|
||||
int Tilemap::tile_width() const
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../world.h"
|
||||
#include <blah.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
using namespace Blah;
|
||||
|
||||
|
@ -23,7 +24,7 @@ namespace TL
|
|||
void render(Batch& batch) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Subtexture[]> m_grid;
|
||||
std::vector<Subtexture> m_grid;
|
||||
int m_tile_width = 0;
|
||||
int m_tile_height = 0;
|
||||
int m_columns = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user