Skip to content

Instantly share code, notes, and snippets.

View eugeneko's full-sized avatar

Eugene Kozlov eugeneko

  • CQG Inc.
  • Yerevan, Armenia (ex. Moscow, Russia)
View GitHub Profile
@eugeneko
eugeneko / convert_enums.py
Last active January 29, 2021 19:04
Script for enum modernization in Urho
import sys
import os
import re
re_enum = re.compile(r'\s*enum\s*(\w+)\s*(:.*)?\s*')
re_enum_value = re.compile(r'\s*(\w+)(?:\s*=\s*(.+))?,?(?:\s*\/\/.*)?\s*')
folders_blacklist = [
# 'Urho3D/Audio',
# 'Urho3D/Container',
# 'Urho3D/Core',
@eugeneko
eugeneko / Main.cpp
Created February 6, 2020 14:28
Urho3D vs EASTL container benchmark
#include <benchmark/benchmark.h>
#include <EASTL/string.h>
#include <EASTL/vector.h>
#include <EASTL/hash_map.h>
#include <Urho3D/Container/Vector.h>
#include <Urho3D/Container/Str.h>
#include <Urho3D/Container/HashMap.h>
static void Test_Trivial_StringVector_EA()
{
@eugeneko
eugeneko / CppCodingStandard.md
Last active September 23, 2019 09:36
C++ CS

C++ Coding Standard

Файлы

Имена файлов

Имена

  • Используются следующие расширения файлов:
  • .h - для заголовочных файлов
@eugeneko
eugeneko / Main.cpp
Created September 17, 2019 22:38
Tests for Urho3D-to-EASTL container migration
void TestContainers()
{
{
Vector<int> v{};
assert(v.Size() == 0);
Vector<int>::Iterator i1 = v.Begin();
Vector<int>::ConstIterator i2 = v.End();
RandomAccessIterator<int> i3 = v.Begin();
@eugeneko
eugeneko / NodeHelper.h
Created August 10, 2019 21:39
Urho3D Node and Component helper
class WeakNodePtr : public WeakPtr<Node>
{
public:
bool LazyFind(Node* parentNode, const char* name, bool recursive = false)
{
return Initialize(parentNode, name, false, recursive);
}
void LazyFindOrCreate(Node* parentNode, const char* name, bool recursive = false)
{
const bool success = Initialize(parentNode, name, true, recursive);
@eugeneko
eugeneko / main.cpp
Last active May 19, 2019 23:13
Universal serealization prototype
#include <Urho3D/Resource/JSONFile.h>
#include <Urho3D/Resource/JSONValue.h>
#include <Urho3D/Resource/XMLElement.h>
#include <Urho3D/Resource/XMLFile.h>
#include <EASTL/optional.h>
/// Type of archive block.
enum class ArchiveBlockType
{
@eugeneko
eugeneko / Archive.h
Last active May 19, 2019 13:07
Archive interface
class Archive
{
/// Binary: [value]
/// XML: <name type="T">value</name>
/// JSON: "name": value (begin block or begin map)
/// value (begin array)
virtual bool Serialize(const char* name, T& value) = 0;
/// Binary: [key][value]
/// XML: <name key="key" type="T">value</name>
/// JSON: "key": value (begin block or begin map)
@eugeneko
eugeneko / CompactFlatVariantMap.h
Created March 20, 2019 19:46
Prototype of container
template <class T, unsigned NBoolsValue = 4, unsigned NIntsValue = 4, unsigned NVariantsValue = 1>
class CompactFlatVariantMap
{
public:
enum class PoolType { Bool, Int, Variant };
using ElementIndex = unsigned;
static const unsigned PoolTypeBits = 2;
static const unsigned PoolTypeMask = (1 << (PoolTypeBits + 1)) - 1;
static const unsigned NBools = NBoolsValue;
@eugeneko
eugeneko / EnTTSummary.md
Last active August 30, 2018 20:40
EnTT API Summary

EnTT API Summary

Registry

Entities

Function Description
create Create an entity
destroy(e) Destroy the entity by ID
@eugeneko
eugeneko / FlagSet.h
Created June 6, 2018 08:41
Flag set template
/// @file ls/common/FlagSet.h
/// @brief Flag set wrapper
#pragma once
#include "ls/common/import.h"
namespace ls
{
/// @addtogroup LsCommon
/// @{