This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fast Hash | |
#if !defined (get16bits) | |
#define get16bits(d) ((((uint32)(((const uint8 *)(d))[1])) << 8)\ | |
+(uint32)(((const uint8 *)(d))[0]) ) | |
#endif | |
// | |
// super hash function by Paul Hsieh | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
/* | |
_____.___. __ __ .__ | |
\__ | | ____ _/ |_ _____ ____ ____ _/ |_ | |__ ____ _______ | |
/ | |_/ __ \ \ __\ \__ \ / \ / _ \ \ __\| | \ _/ __ \ \_ __ \ | |
\____ |\ ___/ | | / __ \_| | \( <_> ) | | | Y \\ ___/ | | \/ | |
/ ______| \___ > |__| (____ /|___| / \____/ |__| |___| / \___ > |__| | |
\/ \/ \/ \/ \/ \/ | |
__________ _____ .__ .__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
{ | |
public: | |
void method(int a, int b) const | |
{ | |
printf("0x%x %d - %d \n", this, a, b); | |
} | |
}; | |
class B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void computeForce(TileSheetNode& node, TileSheetNode& childNode, bool keepClose) | |
{ | |
float dist = distance(node.mPos, childNode.mPos); | |
if (dist < 0.01f) | |
{ | |
return; | |
} | |
float idealDist = node.mRadius + childNode.mRadius; | |
vec_t dir = normalized(node.mPos - childNode.mPos); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Expose c++ class | |
newDSLClass(); // global | |
endClass(); | |
newDSLClass("Health"); | |
member("Life", OFFSETOF(Health.Life"), DSL::Int_t); | |
endClass(); | |
newDSLClass("Entity"); | |
member("Pos", OFFSETOF(Entity.Pos), DSL::vec4_t); | |
member("health", OFFSETOF(entity.health", "Health"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ImApp.h" | |
inline void SpawnDust(EntityManager& manager, Entity& entity) | |
{ | |
if (/*!entity.mStunned &&*/ entity.mCatchedBy != -1) | |
return; | |
float vel = zmax(entity.mVel, entity.mGroupForce.length()); | |
if (vel < FLT_EPSILON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float val(vec2 p) | |
{ | |
return step(length(p-vec2(0.2,0.7)), 0.2); | |
//return texture(iChannel0, src).r; | |
} | |
float GetTh(vec2 src, float sz) | |
{ | |
float p = val(src); | |
float pul = val(src + vec2(-sz, sz)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir emscripten | |
cd emscripten | |
git clone https://github.com/emscripten-core/emsdk.git | |
cd emsdk | |
emsdk install latest | |
emsdk activate latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("Hello world from the cpp side!\n"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emcc helloworld.c -o helloworld.html |
OlderNewer