Skip to content

Commit

Permalink
Merge pull request #34 from Hydrocharged/web-release
Browse files Browse the repository at this point in the history
Web Release
  • Loading branch information
Hydrocharged authored Apr 9, 2022
2 parents 2f7e8ca + c87a1a3 commit c7b6127
Show file tree
Hide file tree
Showing 62 changed files with 7,268 additions and 290 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.git/
.idea/
cmake-build-debug/
cmake-build-release/
cmake-build-release/
cmake-build-web/
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ target_link_libraries(${PROJECT_NAME} raylib)

# Web Configurations
if (${PLATFORM} STREQUAL "Web")
# Tell Emscripten to build an example.html file.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file assets -s USE_GLFW=3 -s WASM=1 -s ASYNCIFY")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
endif()

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://ldjam.com/events/ludum-dare/50/the-fastest-rpg
13 changes: 13 additions & 0 deletions include/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
#include "raylib/raylib.h"
#include "vector"
#include "string"
#include "set"
#include "map"

// GetRandomDouble returns a double between 0.0 and 1.0 inclusive.
double GetRandomDouble();
double GetRandomRange(double min, double max);
int GetRandomRange(int min, int max);
double* GetRandomDistribution(double amountToDistribute, int arraySize);
std::string GetRuneName();
std::string GetEnemyName();

Expand All @@ -26,6 +31,11 @@ class Context {
void Initialize();
void Update();
void Draw();
void AddAnimation(Component* component);
void RemoveAnimation(Component* component);
Component* GetComponent(std::string name);
void RegisterComponent(std::string name, Component* component);
void UnregisterComponent(std::string name);

struct Menus {
friend class Context;
Expand Down Expand Up @@ -115,6 +125,9 @@ class Context {
Menus Menu;
State* GameState;
float Volume = 1;
std::set<Component*> anims;
std::vector<Component*> animsToDelete;
std::map<std::string, Component*> byName;
};

#endif //CONTEXT_H
82 changes: 82 additions & 0 deletions include/emscripten/atomic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright 2015 The Emscripten Authors. All rights reserved.
* Emscripten is available under two separate licenses, the MIT license and the
* University of Illinois/NCSA Open Source License. Both these licenses can be
* found in the LICENSE file.
*/

#pragma once

#include <inttypes.h>

#ifdef __cplusplus
extern "C" {
#endif

// Note on 64bit atomics ops: All 64-bit atomic ops defined here, while single
// instruction under wasm, will be emulated by using locks in wasm2js mode.
// This is also true for C/C++ native atomics as well as intrinsics.

// Atomically stores the given value to the memory location, and returns the
// value that was there prior to the store.
uint8_t emscripten_atomic_exchange_u8(void/*uint8_t*/ *addr, uint8_t newVal);
uint16_t emscripten_atomic_exchange_u16(void/*uint16_t*/ *addr, uint16_t newVal);
uint32_t emscripten_atomic_exchange_u32(void/*uint32_t*/ *addr, uint32_t newVal);
uint64_t emscripten_atomic_exchange_u64(void/*uint64_t*/ *addr, uint64_t newVal);

// CAS returns the *old* value that was in the memory location before the
// operation took place.
// That is, if the return value when calling this function equals to 'oldVal',
// then the operation succeeded, otherwise it was ignored.
uint8_t emscripten_atomic_cas_u8(void/*uint8_t*/ *addr, uint8_t oldVal, uint8_t newVal);
uint16_t emscripten_atomic_cas_u16(void/*uint16_t*/ *addr, uint16_t oldVal, uint16_t newVal);
uint32_t emscripten_atomic_cas_u32(void/*uint32_t*/ *addr, uint32_t oldVal, uint32_t newVal);
uint64_t emscripten_atomic_cas_u64(void/*uint64_t*/ *addr, uint64_t oldVal, uint64_t newVal);

uint8_t emscripten_atomic_load_u8(const void/*uint8_t*/ *addr);
uint16_t emscripten_atomic_load_u16(const void/*uint16_t*/ *addr);
uint32_t emscripten_atomic_load_u32(const void/*uint32_t*/ *addr);
float emscripten_atomic_load_f32(const void/*float*/ *addr);
uint64_t emscripten_atomic_load_u64(const void/*uint64_t*/ *addr);
double emscripten_atomic_load_f64(const void/*double*/ *addr);

// Returns the value that was stored (i.e. 'val')
uint8_t emscripten_atomic_store_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_store_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_store_u32(void/*uint32_t*/ *addr, uint32_t val);
float emscripten_atomic_store_f32(void/*float*/ *addr, float val);
uint64_t emscripten_atomic_store_u64(void/*uint64_t*/ *addr, uint64_t val);
double emscripten_atomic_store_f64(void/*double*/ *addr, double val);

void emscripten_atomic_fence(void);

// Each of the functions below (add, sub, and, or, xor) return the value that
// was in the memory location before the operation occurred.
uint8_t emscripten_atomic_add_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_add_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_add_u32(void/*uint32_t*/ *addr, uint32_t val);
uint64_t emscripten_atomic_add_u64(void/*uint64_t*/ *addr, uint64_t val);

uint8_t emscripten_atomic_sub_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_sub_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_sub_u32(void/*uint32_t*/ *addr, uint32_t val);
uint64_t emscripten_atomic_sub_u64(void/*uint64_t*/ *addr, uint64_t val);

uint8_t emscripten_atomic_and_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_and_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_and_u32(void/*uint32_t*/ *addr, uint32_t val);
uint64_t emscripten_atomic_and_u64(void/*uint64_t*/ *addr, uint64_t val);

uint8_t emscripten_atomic_or_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_or_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_or_u32(void/*uint32_t*/ *addr, uint32_t val);
uint64_t emscripten_atomic_or_u64(void/*uint64_t*/ *addr, uint64_t val);

uint8_t emscripten_atomic_xor_u8(void/*uint8_t*/ *addr, uint8_t val);
uint16_t emscripten_atomic_xor_u16(void/*uint16_t*/ *addr, uint16_t val);
uint32_t emscripten_atomic_xor_u32(void/*uint32_t*/ *addr, uint32_t val);
uint64_t emscripten_atomic_xor_u64(void/*uint64_t*/ *addr, uint64_t val);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit c7b6127

Please sign in to comment.