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 "flecs.h" | |
#include "inttypes.h" | |
#include <cstdio> | |
#include <ctime> | |
auto nanos() { | |
timespec Time; | |
clock_gettime(CLOCK_MONOTONIC, &Time); | |
return Time.tv_sec * int64_t{1000000000} + (int64_t)Time.tv_nsec; | |
} |
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 <flecs.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define MILLION (1000 * 1000) | |
#define ENTITY_COUNT (100) | |
#define SAMPLE_COUNT (1000) | |
struct Comp1 { |
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 <ctime> | |
#include <cstdio> | |
#include "flecs.h" | |
#include "inttypes.h" | |
auto nanos() { | |
timespec Time; | |
clock_gettime(CLOCK_MONOTONIC, &Time); | |
return Time.tv_sec * int64_t{1000000000} + (int64_t)Time.tv_nsec; | |
} |
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
struct FUpdateHierarchyStaticState{ | |
static constexpr uint32 MaxSize = 100; | |
FUpdateHierarchyStaticState() { | |
Entities.Resize(MaxSize); | |
Views.Resize(MaxSize); | |
Positions.Resize(MaxSize); | |
Alignments.Resize(MaxSize, {0.5f, 0.0f}); | |
Colors.Resize(MaxSize, {Color::ToFloatColor(0xbfbfbfff)}); | |
Fonts.Resize(MaxSize, {EFont::Small}); |
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 | |
#include "Allocator.inl" | |
namespace SE { | |
template<bool SingleFrame> | |
void *TDynamicAllocator<SingleFrame>::AlignPointer(void *Pointer, uint32 Extra, uint32 Alignment) { | |
byte *Address = (byte *)Pointer + Extra; // Space for header. | |
uintptr_t Aligned = Math::AlignUp((uintptr_t)Address, (uintptr_t)Alignment); | |
return (void *)Aligned; |
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 | |
#include "HashMapIterators.h" | |
namespace SE { | |
template<typename TKey, typename TValue, template<typename> typename THasherTemplate> | |
class THashMap { | |
private: | |
using FEntry = Impl::THashMapEntry<TKey, TValue>; |
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
if constexpr (TermCount == 1) { | |
auto Builder = ECS.observer(); | |
ConstructObserver<TArgs...>(Builder).event(Event); | |
if constexpr (FuncArgCount > 0) { | |
if constexpr (FuncArgCount == 1) { | |
// Callback only receives one parameter: entity / iter & | |
if constexpr (Meta::IsSame<Meta::TParameterPackFirstType<TFuncParams>, entity>) { | |
auto Trigger = Builder.iter([TermComponentIds, Callback = Meta::Forward<TFunc>(Func)](iter &Iter) { | |
Mutations.BeginIter(EIterationType::Observer, View(TermComponentIds)); | |
for (auto Index : Iter) { |
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 TestPrefabPerformance(ecs &ECS) { | |
constexpr uint32 Count = 100000; | |
TStackArray<entity_view, Count> Entities; | |
struct CComp1 { | |
uint64 Field1; | |
uint64 Field2; | |
uint64 Field3; | |
uint64 Field4; | |
uint64 Field5; | |
char Field6; |
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
Import<MCoreComponents>(ECS); | |
Import<MGameStateComponents>(ECS); | |
Import<MLifespanComponents>(ECS); | |
Import<MPlayerControllerComponents>(ECS); | |
Import<MTilesComponents>(ECS); | |
Import<MEditorTilesComponents>(ECS); | |
Import<MRenderTilesComponents>(ECS); | |
Import<MInputComponents>(ECS); | |
Import<MMouseControlsComponents>(ECS); | |
Import<MPhysicsComponents>(ECS); |
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 "Core.h" | |
#include "CoreReflection.h" | |
#include "Engine/Engine.h" | |
#include "Engine/SDL/SDL.h" | |
namespace SE { | |
namespace Impl { |