Skip to content

Instantly share code, notes, and snippets.

@andrew-git
andrew-git / gist:5c53656e1c1ef035797dafada2422ac6
Created June 14, 2024 10:09 — forked from adamnemecek/gist:ae2755c5c4eaabd0d864e6c62dbe5088
Overview of Entity Component System (ECS) variations with pseudo-code

For background and further references see: Entity Component Systems on Wikipedia

ECS by Scott Bilas (GDC 2002)

Entity->Components->Update
  • entity = class: no logic + no data OR at most small set of frequently used data (ie position)
  • component = class: logic + data
foreach entity in allEntities do
    foreach component in entity.components do
@andrew-git
andrew-git / SteamBuild.cs
Created March 11, 2023 10:02 — forked from Marc-Ducret/SteamBuild.cs
Automate build and deploy to Steam
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using DiceKingdoms.Meta;
using UnityEngine;
using Unity.Build;
using UnityEditor;
@andrew-git
andrew-git / CPPRandomSeed.hx
Last active March 9, 2021 16:26 — forked from player-03/CPPRandomSeed.hx
Seed the random number generator in C++.
@:cppInclude('time.h')
class CPPRandomSeed {
public static function seed() {
#if cpp
untyped __cpp__('srand48(time(NULL))');
#end
}
}
@andrew-git
andrew-git / AMF3Tools.hx
Last active August 10, 2018 16:22
Untyped AMF3 decoder (like a flash)
// original https://github.com/HaxeFoundation/format/blob/master/format/amf3/Tools.hx
/*
* format - haXe File Formats
*
* Copyright (c) 2008, The haXe Project Contributors
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@andrew-git
andrew-git / BuildNapeSwc.txt
Last active March 10, 2019 15:51
Build Nape swc
Устанавливаем Haxe http://haxe.org/download/
Устанавливаем neko http://nekovm.org/download
Скачиваем исходники Nape на Haxe http://lib.haxe.org/p/nape/ и распаковываем в папку проекта в папку src (в ней будут nape и zpp_nape)
Скачиваем flib.n в папку проекта https://github.com/deltaluca/flib/tree/master/bin
Нужен 7-zip (можно положить в папку проекта 7-zip.dll, 7z.dll и 7z.exe)
Собираем
Чтобы создать релизную сборку выполнить в папке проекта
haxe -cp src -dce full --macro "include('nape')" --macro "include('zpp_nape')" -D nape_swc -D flib -swf nape_dev.swc -swf-version 11 -D NAPE_RELEASE_BUILD
Чтобы создать дев сборку выполнить в папке проекта
haxe -cp src -dce full --macro "include('nape')" --macro "include('zpp_nape')" -D nape_swc -D flib -swf nape_dev.swc -swf-version 11
@andrew-git
andrew-git / gist:44f831631783defe9ebf
Created October 30, 2015 11:27 — forked from neuronix/gist:473a38d9fa14690b863f
Creating iOS certificates (.p12) for Adobe AIR on Windows with OpenSSL
:: Creating iOS certificates on windows for Adobe AIR
:: Install OpenSSL: https://www.openssl.org/source/
:: 1. Use cmd to get to openssl bin folder
:: 2. run openssl
:: 3. in openssl console: genrsa -out ios_distribution.key 2048
:: 4. in openssl console: req -new -key ios_distribution.key -out CertificateSigningRequest_distribution.certSigningRequest -subj "/emailAddress=<your@email.com>, CN=<YourCompany>, C=<CountryCode:FR>"
:: 5. repeat 4. with "_development" instead of "_distribution"
:: 6. Use both CSR requests on itunes portal to generate the certificate files (.cer)
:: 7. Use this .bat to generate the .p12 files
:: Bonus. Same process to generate push certificates
class Main extends Sprite
{
private var doneFrame:Bool;
public function new()
{
super();
doneFrame = false;
graphics.beginFill(0xff5555);
@andrew-git
andrew-git / FD
Last active August 29, 2015 14:06
FD
--- 1 KeyboardEvent/MouseEvent generation
2 Array<T>
---5 3 func(a[i]) => func (Array<T
4 "Find all references" and refresh Task without external libs
--- 5 Non-static getter/setter for static properties
6 FD builds flash debug version in release build if "Debug Enabled"
--- 7 Wrong vars generation in Main class (shifted "{")
8 function some(func:Function) => propose generate private var
9 var t:int = func(); => func():void
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.DisplayObject;
import flash.Lib;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import openfl.Assets;
import openfl.display.Tilesheet;
import flash.display.Graphics;
import flash.events.Event;
class Particle