size_t pretty_type() [T = Position]
size_t pretty_enum() [E = Color, C = Red]
size_t pretty_enum() [E = Color, C = 3]
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
use bevy_ecs::prelude::*; | |
use bevy_hierarchy::*; | |
use bevy_ecs::world::CommandQueue; | |
use std::hint::black_box; | |
use rand; | |
use std::time::{Instant}; | |
#[derive(Component)] |
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
// Test for importing script from URL | |
using flecs.components.* | |
using flecs.game | |
using assemblies | |
town :- Town{} |
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 <c_app.h> | |
#include "flecs.h" | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define STARS (1000) | |
#define PLANETS_MAX (10) | |
#define P_PLANET_WATER (0.1) | |
#define P_PLANET_OIL (0.005) | |
#define P_PLANET_COPPER (0.05) |
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 <bench_path.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "entt.hpp" | |
#define MILLION (1000 * 1000) | |
#define BILLION (1000 * MILLION) | |
#define ENTITY_COUNT (255) | |
#define COMPONENT_COUNT (10) |
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
entity.add<MeleeUnit>(); |
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
// Utility for adding features (mixins) to a class without modifying its | |
// definition. | |
// -- Mixin code | |
// Create macro for mixin template type so we don't go cross-eyed | |
#define MIXIN template<typename Self> typename | |
// Template that can store a list of mixin templates |
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
// Summary of Flecs data structures | |
// This is a non-exhaustive overview of flecs datastructures. Things have been ommitted/have different names for clarity. | |
// --- DATASTRUCTURES | |
// A sparse set is a map-like structure that guarantees O(1) lookup times (as opposed to O(1) on average for maps) at the cost of | |
// requiring more RAM (more info on the general idea of sparse sets: https://www.geeksforgeeks.org/sparse-set/) | |
struct ecs_sparse_t { }; |
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
// - each expression has a type & an optional value. | |
// | |
// - if the expression is an integer literal: | |
// - the type is Integer | |
// - the value is the integer value | |
// | |
// - if the expression is an floating point literal: | |
// - the type is Float | |
// - the value is the integer value |
NewerOlder