Skip to content

Instantly share code, notes, and snippets.

View PixeyeHQ's full-sized avatar
👑
Focusing

Dmitry Mitrofanov PixeyeHQ

👑
Focusing
View GitHub Profile
namespace Pixeye.Source
{
sealed class ProcessorRope : Processor<ComponentRope>, ITick
{
public override void HandleEvents()
{
foreach (ent entity in source.removed)
{
var cRope = entity.componentRope();
cRope.renderer.gameObject.Release();
@PixeyeHQ
PixeyeHQ / mdl_observer.nim
Last active June 22, 2021 11:41
On value change observer
from sugar import `=>`, `->`
export `->`, `=>`
type Wrapper[TSource, TProp] = ref object
source: TSource
val: TProp
prop: proc(arg: TSource): TProp
callback: proc(arg: TSource)
var storage = newSeq[proc()](0)
@PixeyeHQ
PixeyeHQ / 7zip-pix.json
Last active March 16, 2020 10:09
7zip-pix
{
"homepage": "http://www.info-zip.org/",
"license": {
"identifier": "Freeware",
"url": "http://infozip.sourceforge.net/doc/LICENSE"
},
"description": "Zip compression utilities",
"version": "3.0",
"bin": [
"zip.exe",
namespace Pixeye.Source
{
sealed class ProcessorTest : Processor, ITick
{
public Group<ComponentPosition> groupThreaded;
public ProcessorTest()
{
groupThreaded.MakeConcurrent(100000, Environment.ProcessorCount - 1, HandleCalculation);
}
@PixeyeHQ
PixeyeHQ / Slicer.cs
Last active September 9, 2019 04:01
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T[] Slice<T>(this T[] source, string from, int end) where T : UnityEngine.Object
{
Predicate<T> predicate = s => s.name == from;
var start = -1;
for (int i = 0; i < source.Length; i++)
{
ref var val = ref source[i];
if (predicate(val))
@PixeyeHQ
PixeyeHQ / ComponentParent.cs
Last active August 17, 2019 20:29
ECS Parents and Childs
using UnityEngine;
using Pixeye.Framework;
using System.Runtime.CompilerServices;
namespace Pixeye.Source
{
sealed class ComponentParent
{
public ent[] childs = new ent[10];
[StructLayout(LayoutKind.Sequential)]
public unsafe struct BufferTags
{
// tags
#if ACTORS_TAGS_24 || ACTORS_TAGS_DEFAULT
public const int Capacity = 24;
private ushort tag0;
private ushort tag1;
using System.Collections.Generic;
namespace Pixeye.Framework{
///<summary>
/// Mutable String class, optimized for speed and memory allocations while retrieving the final result as a string.
/// Similar use than StringBuilder, but avoid a lot of allocations done by StringBuilder (conversion of int and float to string, frequent capacity change, etc.)
/// Author: Nicolas Gadenne contact@gaddygames.com
@PixeyeHQ
PixeyeHQ / gist:4fdd5c7c795ecc5c4ff5168574112590
Created October 2, 2018 09:40
Custom 2d shader for HDR and color replacement
Shader "Homebrew/Sprites/Diffuse"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _Flip ("Flip", Vector) = (1,1,1,1)
[PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {}