Skip to content

Instantly share code, notes, and snippets.

View AustinBrunkhorst's full-sized avatar
🔥

Austin Brunkhorst AustinBrunkhorst

🔥
View GitHub Profile
@AustinBrunkhorst
AustinBrunkhorst / EntityFilter.h
Last active August 29, 2015 14:06
Entity Filter System with a hint of magic
#pragma once
#include "ComponentsConfig.h"
namespace Ursine
{
// forward declarations
class Entity;
class EntityFilter
@AustinBrunkhorst
AustinBrunkhorst / MyFilterSystem.h
Created October 19, 2014 10:59
Filter System Example
class MyFilterSystem : public FilterSystem
{
public:
MyFilterSystem(World &world)
: FilterSystem(world, Filter().All<>().Exclude<>().One<>())
{
}
~MyFilterSystem(void)
struct CollisionEventArgs : public EventArgs
{
// bullet
Entity *sender;
// player
Entity *reciever;
// ... other collision related data
};
@AustinBrunkhorst
AustinBrunkhorst / app.html
Last active November 23, 2017 14:28 — forked from jdanyow/app.html
Aurelia Menu Sample
<template>
<require from="resources-elements-nav-menu.html" as="nav-menu"></require>
<nav-menu router.bind="router"></nav-menu>
<h1>Aurelia Menu with Child Routes example</h1>
<div>
<router-view></router-view>
</div>
</template>
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_prebuild_example.cmake
Created March 24, 2018 23:57
C++ Reflection | CMake Prebuild Example
set(PROJECT_NAME "Example")
# assume this contains header files for this project
set(PROJECT_HEADER_FILES ...)
# assume this contains source files for this project
set(PROJECT_SOURCE_FILES ...)
# generated file names, in the build directory
set(META_GENERATED_HEADER "${CMAKE_CURRENT_BINARY_DIR}/Meta.Generated.h")
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_complete_example.cpp
Created March 25, 2018 00:00
C++ Reflection | Complete Example
struct SoundEffect
{
Meta(Range(0.0f, 100.0f))
float volume;
};
int main(void)
{
// you can also use type meta::Type::Get( "SoundEffect" ) based on a string name
Type soundEffectType = typeof( SoundEffect );
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_attribute_example.cpp
Created March 25, 2018 00:01
C++ Reflection | Attribute Example
enum class SliderType
{
Horizontal,
Vertical
};
struct Slider : public MetaProperty
{
SliderType type;
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_function_example.cpp
Created March 25, 2018 00:02
C++ Reflection | Functions
struct SoundEffect
{
float volume;
void Load(const std::string &filename);
};
int main(void)
{
Type soundEffectType = typeof( SoundEffect );
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_lambda_wrapper.cpp
Created March 25, 2018 00:03
C++ Reflection | Lambda Wrapper
class DemoClass
{
public:
int someMethod(int a)
{
return a;
}
};
auto someMethodWrapper = [](Variant &obj, ArgumentList &args)
@AustinBrunkhorst
AustinBrunkhorst / blog_meta_wrapper_example.cpp
Created March 25, 2018 00:04
C++ Reflection | Function Wrapper Example
int foo(int a, float b, double c)
{
return 0;
}
auto fooWrapper = [](int a, float b, double c)
{
return foo( a, b, c );
};