Skip to content

Commit

Permalink
New target platform WebAssembly
Browse files Browse the repository at this point in the history
  • Loading branch information
schellingb committed Jun 19, 2019
1 parent f5ecabb commit 9158db7
Show file tree
Hide file tree
Showing 30 changed files with 2,444 additions and 348 deletions.
1 change: 1 addition & 0 deletions Games.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Screenshot | Description
:---:|---
[<img src="https://zillalib.github.io/games/Hexzilla_Thumb.png">](https://zillalib.github.io/games/Hexzilla_Full.png)|**Hexzilla**<br><br>Hexagonal base building strategy action!<br>Build your bastion with upgradable credit farms, turrets and shields, and defend it against incoming waves of enemy swarms!<br><br>How many waves can your base stand against?<br><br>Made in 48 hours, placed #68 in <a href="http://ludumdare.com/compo/ludum-dare-26/?action=preview&uid=20775">Ludum Dare 26</a><br><br>Source: [Visit GitHub Repository](https://github.com/schellingb/Hexzilla)<br>Play: [Run in Web Browser](https://zillalib.github.io/games/?Hexzilla)<br>Download: [Win32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla_Win32.zip) / [Win64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla_Win64.zip) / [Android](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla.apk) / [macOS](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla_osx.zip) / [Linux32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla_linux_x86_32.zip) / [Linux64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Hexzilla_linux_x86_64.zip)
[<img src="https://zillalib.github.io/games/AltarWar_Thumb.png">](https://zillalib.github.io/games/AltarWar_Full.png)|**Altar War**<br><br>Slay and sacrifice the demons on the altar to keep the light ignited!<br><br>Compete for score in this action game made over 48 hours.<br><br>3D game created for <a href="https://ldjam.com/events/ludum-dare/43/$132097">Ludum Dare 43</a>.<br><br>Source: [Visit GitHub Repository](https://github.com/schellingb/AltarWar)<br>Play: [Run in Web Browser](https://zillalib.github.io/games/?AltarWar)<br>Download: [Win32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar_Win32.zip) / [Win64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar_Win64.zip) / [Android](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar.apk) / [macOS](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar_osx.zip) / [Linux32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar_linux_x86_32.zip) / [Linux64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/AltarWar_linux_x86_64.zip)
[<img src="https://zillalib.github.io/games/LazerMaze_Thumb.png">](https://zillalib.github.io/games/LazerMaze_Full.png)|**Lazer Maze**<br><br>You are trapped in the Lazer Maze, can you find the way to the goal?<br><br>This game contains color mixing puzzles so it might not play well if you're colorblind :-( Maybe that can be improved in a future version.<br><br>Source: [Visit GitHub Repository](https://github.com/schellingb/LazerMaze)<br>Play: [Run in Web Browser](https://zillalib.github.io/games/?LazerMaze)<br>Download: [Win32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze_Win32.zip) / [Win64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze_Win64.zip) / [Android](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze.apk) / [macOS](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze_osx.zip) / [Linux32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze_linux_x86_32.zip) / [Linux64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/LazerMaze_linux_x86_64.zip)
[<img src="https://zillalib.github.io/games/MercReckoning_Thumb.png">](https://zillalib.github.io/games/MercReckoning_Full.png)|**Mercenary Reckoning**<br><br>Hire a team of freshmen mercenaries and fight the survival deathmatch against nature on offshore islands!<br><br>Chose the members of your team from a group of unique personalities and enter the battle zone. Set individual movement and attack paths for each of your mercenaries and ambush your enemies. Try yourself at the 10 different levels each with different enemies and environments. Between the levels you can use the rewards to hire new members and refill your tired soldiers.<br><br>Mercenary Reckoning is an action strategy game that can be played as fast or slow as you want. The action can always be paused if you need to rethink your strategy. You can also easily drag new movement paths for your mercenaries while the game is running.<br><br>Can you beat the 10 rounds of the Mercenary Reckoning?<br><br>Source: [Visit GitHub Repository](https://github.com/schellingb/MercReckoning)<br>Play: [Run in Web Browser](https://zillalib.github.io/games/?MercReckoning)<br>Download: [Win32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning_Win32.zip) / [Win64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning_Win64.zip) / [Android](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning.apk) / [macOS](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning_osx.zip) / [Linux32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning_linux_x86_32.zip) / [Linux64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/MercReckoning_linux_x86_64.zip)
[<img src="https://zillalib.github.io/games/Puzilla_Thumb.png">](https://zillalib.github.io/games/Puzilla_Full.png)|**Puzilla**<br><br>Physics! Chain falling blocks for high combos!<br><br>Blocks fall from the top and same colored ones get linked together when next to each other.<br>You can run & jump through the block maze and create blasts which throw nearby blocks in the air and away.<br>Try to link as many blocks as possible and then clear them for high combo scores!<br><br>Source: [Visit GitHub Repository](https://github.com/schellingb/Puzilla)<br>Play: [Run in Web Browser](https://zillalib.github.io/games/?Puzilla)<br>Download: [Win32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla_Win32.zip) / [Win64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla_Win64.zip) / [Android](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla.apk) / [macOS](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla_osx.zip) / [Linux32](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla_linux_x86_32.zip) / [Linux64](https://github.com/ZillaLib/zillalib.github.io/releases/download/games/Puzilla_linux_x86_64.zip)
Expand Down
8 changes: 4 additions & 4 deletions Include/ZL_Application.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
ZillaLib
Copyright (C) 2010-2018 Bernhard Schelling
Copyright (C) 2010-2019 Bernhard Schelling
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -59,10 +59,10 @@
#endif
#endif
#ifndef __WEBAPP__
#if defined(__native_client__)
#define __NACL__
#if defined(__wasm__) || defined(__EMSCRIPTEN__)
#define __WEBAPP__
#elif defined(__EMSCRIPTEN__)
#elif defined(__native_client__)
#define __NACL__
#define __WEBAPP__
#endif
#endif
Expand Down
4 changes: 2 additions & 2 deletions Include/ZL_Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ template <typename C_ARRAY, size_t N> char (&__COUNT_OF_HELPER(C_ARRAY(&)[N]))[N
#define RAND_COLOR (ZL_Color(RAND_FACTOR,RAND_FACTOR,RAND_FACTOR)) // random color (any brightness)
#define RAND_BRIGHTCOLOR (ZL_Color::HSVA(RAND_FACTOR,1,1)) // random hued color with max brightness
#define RAND_CHANCE(val) (ZL_Rand::Int((int)(val)-1)==0) // returns true one out of [val] times
#define RAND_ARRAYELEMENT(arr) arr[ZL_Rand::Int(COUNT_OF(arr)-1)] // random element of c-array
#define RAND_VECTORELEMENT(vec) vec[ZL_Rand::Int(vec.size()-1)] // random element of vector
#define RAND_ARRAYELEMENT(arr) (arr)[ZL_Rand::Int(COUNT_OF(arr)-1)] // random element of c-array
#define RAND_VECTORELEMENT(vec) (vec)[ZL_Rand::Int((int)(vec).size()-1)] // random element of vector

#undef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
Expand Down
4 changes: 2 additions & 2 deletions Include/ZL_Network.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
ZillaLib
Copyright (C) 2010-2016 Bernhard Schelling
Copyright (C) 2010-2019 Bernhard Schelling
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand All @@ -25,7 +25,7 @@
#include "ZL_Signal.h"
#include "ZL_String.h"

#if defined(__native_client__) || defined(__EMSCRIPTEN__)
#if defined(__wasm__) || defined(__EMSCRIPTEN__) || defined(__native_client__)
#define ZL_NO_SOCKETS
#endif

Expand Down
84 changes: 41 additions & 43 deletions Include/ZL_String.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
ZillaLib
Copyright (C) 2010-2018 Bernhard Schelling
Copyright (C) 2010-2019 Bernhard Schelling
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -58,8 +58,6 @@ typedef unsigned int u32;
class ZL_String : public std::string
{
typedef std::string str;
typedef std::ostringstream ostr;
typedef std::istringstream istr;
typedef unsigned char uchr;
typedef signed char schr;

Expand Down Expand Up @@ -92,14 +90,14 @@ class ZL_String : public std::string
ZL_String(const chr source) { assign(1, source); }
ZL_String(const uchr source) { assign(1, (chr)source); }
ZL_String(const schr source) { assign(1, (chr)source); }
ZL_String(const unsigned int source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const signed int source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const unsigned short source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const signed short source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const unsigned long source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const signed long source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const float source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const double source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const unsigned int source) { operator<<(source); }
ZL_String(const signed int source) { operator<<(source); }
ZL_String(const unsigned short source) { operator<<(source); }
ZL_String(const signed short source) { operator<<(source); }
ZL_String(const unsigned long source) { operator<<(source); }
ZL_String(const signed long source) { operator<<(source); }
ZL_String(const float source) { operator<<(source); }
ZL_String(const double source) { operator<<(source); }

ZL_String& operator +=(const ZL_String &source) { append(source); return *this; }
ZL_String& operator +=(const str &source) { append(source); return *this; }
Expand All @@ -109,14 +107,14 @@ class ZL_String : public std::string
ZL_String& operator +=(const chr source) { append(1, source); return *this; }
ZL_String& operator +=(const uchr source) { append(1, (chr)source); return *this; }
ZL_String& operator +=(const schr source) { append(1, (chr)source); return *this; }
ZL_String& operator +=(const unsigned int source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const signed int source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const unsigned short source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const signed short source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const unsigned long source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const signed long source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const double source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const float source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const unsigned int source) { return operator<<(source); }
ZL_String& operator +=(const signed int source) { return operator<<(source); }
ZL_String& operator +=(const unsigned short source) { return operator<<(source); }
ZL_String& operator +=(const signed short source) { return operator<<(source); }
ZL_String& operator +=(const unsigned long source) { return operator<<(source); }
ZL_String& operator +=(const signed long source) { return operator<<(source); }
ZL_String& operator +=(const double source) { return operator<<(source); }
ZL_String& operator +=(const float source) { return operator<<(source); }
ZL_String& operator <<(const ZL_String &source) { append(source); return *this; }
ZL_String& operator <<(const str &source) { append(source); return *this; }
ZL_String& operator <<(const chr *source) { append(source); return *this; }
Expand All @@ -125,14 +123,14 @@ class ZL_String : public std::string
ZL_String& operator <<(const chr source) { append(1, source); return *this; }
ZL_String& operator <<(const uchr source) { append(1, (chr)source); return *this; }
ZL_String& operator <<(const schr source) { append(1, (chr)source); return *this; }
ZL_String& operator <<(const unsigned int source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const signed int source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const unsigned short source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const signed short source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const unsigned long source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const signed long source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const double source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const float source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const unsigned int source);
ZL_String& operator <<(const signed int source);
ZL_String& operator <<(const unsigned short source);
ZL_String& operator <<(const signed short source);
ZL_String& operator <<(const unsigned long source);
ZL_String& operator <<(const signed long source);
ZL_String& operator <<(const double source);
ZL_String& operator <<(const float source);
ZL_String operator +(const ZL_String &source) const { ZL_String r(*this); r.append(source); return r; }
ZL_String operator +(const str &source) const { ZL_String r(*this); r.append(source); return r; }
ZL_String operator +(const chr *source) const { ZL_String r(*this); r.append(source); return r; }
Expand All @@ -141,14 +139,14 @@ class ZL_String : public std::string
ZL_String operator +(const chr source) const { ZL_String r(*this); r.append(1, source); return r; }
ZL_String operator +(const uchr source) const { ZL_String r(*this); r.append(1, (chr)source); return r; }
ZL_String operator +(const schr source) const { ZL_String r(*this); r.append(1, (chr)source); return r; }
ZL_String operator +(const unsigned int source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const signed int source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const unsigned short source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const signed short source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const unsigned long source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const signed long source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const double source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const float source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const unsigned int source) const { return *this + ZL_String(source); }
ZL_String operator +(const signed int source) const { return *this + ZL_String(source); }
ZL_String operator +(const unsigned short source) const { return *this + ZL_String(source); }
ZL_String operator +(const signed short source) const { return *this + ZL_String(source); }
ZL_String operator +(const unsigned long source) const { return *this + ZL_String(source); }
ZL_String operator +(const signed long source) const { return *this + ZL_String(source); }
ZL_String operator +(const double source) const { return *this + ZL_String(source); }
ZL_String operator +(const float source) const { return *this + ZL_String(source); }

void operator *=(int level) { if (level <= 0) erase(); else { size_t len = size(); while (--level) append(c_str(), len); } }

Expand All @@ -168,14 +166,14 @@ class ZL_String : public std::string

//Older Visual C++ aren't able to handle 64bit numbers being put into std::ostringstream
#if (!defined(_MSC_VER) || _MSC_VER > 1200)
ZL_String(const u64 source) { ostr o; if (o << source) assign(o.str()); }
ZL_String(const i64 source) { ostr o; if (o << source) assign(o.str()); }
ZL_String& operator +=(const u64 source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator +=(const i64 source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const u64 source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String& operator <<(const i64 source) { ostr o; if (o << source) append(o.str()); return *this; }
ZL_String operator +(const u64 source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String operator +(const i64 source) const { ZL_String r(*this); ostr o; if (o << source) r.append(o.str()); return r; }
ZL_String(const u64 source) { operator<<(source); }
ZL_String(const i64 source) { operator<<(source); }
ZL_String& operator +=(const u64 source) { return operator<<(source); }
ZL_String& operator +=(const i64 source) { return operator<<(source); }
ZL_String& operator <<(const u64 source);
ZL_String& operator <<(const i64 source);
ZL_String operator +(const u64 source) const { return *this + ZL_String(source); }
ZL_String operator +(const i64 source) const { return *this + ZL_String(source); }
#endif
};

Expand Down
Loading

0 comments on commit 9158db7

Please sign in to comment.