This file contains hidden or 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class UIBorder : MaskableGraphic { | |
[SerializeField] | |
float cornerRadius = 5; | |
[SerializeField] |
This file contains hidden or 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 Semaphore | |
{ | |
std::atomic_int count = 0; | |
std::condition_variable cond_var; | |
std::mutex mutex; | |
void wait() { | |
std::unique_lock<std::mutex> lock(mutex); | |
while (!count) |
This file contains hidden or 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<memory> | |
template<typename T, size_t ChunkSize = 1024> | |
struct pool_allocator | |
{ | |
using alloc_type = T; | |
using pointer_type = alloc_type*; | |
pool_allocator() |
This file contains hidden or 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<memory> | |
template<int alignment> | |
struct aligned_allocator | |
{ | |
static_assert((alignment&(alignment - 1)) == 0, "alignment must be power of 2."); | |
void* allocate(size_t size) { |
This file contains hidden or 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 <future> | |
struct SpinLock { | |
std::atomic_flag spin_flag = ATOMIC_FLAG_INIT; | |
void lock() { | |
for (size_t k = 0; spin_flag.test_and_set(std::memory_order_acquire); k++) | |
{ | |
if (k < 4) | |
{ |
This file contains hidden or 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
template<typename L1, typename L2> | |
struct S : L1, L2 | |
{ | |
S(L1 l1, L2 l2) :L1( std::move(l1) ), L2( std::move(l2) ) | |
{ | |
} | |
using L1::operator(); | |
using L2::operator(); |
This file contains hidden or 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
using UnityEngine; | |
using UnityEngine.EventSystems; | |
public class PageViewController : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerDownHandler, IPointerUpHandler | |
{ | |
public enum Direction | |
{ | |
Horizontal, | |
Vertical | |
} |
This file contains hidden or 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<type_traits> | |
template <typename T> class Delegate; | |
template<class R, class ...Args> | |
class Delegate <R(Args...)> final | |
{ |
This file contains hidden or 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
Shader "UI/Dissolve" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
_Color ("Tint", Color) = (1,1,1,1) | |
_StencilComp ("Stencil Comparison", Float) = 8 | |
_Stencil ("Stencil ID", Float) = 0 | |
_StencilOp ("Stencil Operation", Float) = 0 |
This file contains hidden or 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
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
public class ExportSprites { | |
[MenuItem("Assets/Create/SpriteScriptableObject")] | |
static void Export() | |
{ | |
foreach (var sprite in Selection.objects) { |