Skip to content

Instantly share code, notes, and snippets.

@seyhajin
seyhajin / readme.md
Last active February 22, 2023 11:21
Minimal sprite rendering example written in C with `SDL2` for windowing, `sokol_gfx` for graphics API using WebGL2/GLES3, `stb_image` for loading image, compiled in WebAssembly with Emscripten

webgl2-wasm-sdl-sokol-sprite

Minimal sprite rendering example written in C with SDL2 for windowing, sokol_gfx for graphics API using WebGL2/GLES3, stb_image for loading image, compiled in WebAssembly with Emscripten.

Step by step

  1. Clone the repositories sokol and stb in the deps folder
  2. Add an image (sky.png) in assets directory
  3. Compile and build with the following command (need Emscripten installed):
@AKosmachyov
AKosmachyov / Player-MVVM-SwiftUI.md
Last active February 10, 2024 18:21
SwiftUI + Combine. Sync Slider & AVPlayer states. MVVM
@0xLeif
0xLeif / metal_01_swiftui.swift
Last active May 6, 2023 11:47
Metal + SwiftUI
//
// ContentView.swift
// MetalSwiftUI
//
// Created by Zach Eriksen on 9/8/20.
// Copyright © 2020 oneleif. All rights reserved.
//
// Inspired [MetalUI](https://github.com/0xLeif/MetalUI)
import SwiftUI
@karljj1
karljj1 / Unity Assembly Definition Debugger.cs
Last active March 27, 2024 17:18
Find out what assemblies are being built and how long each takes.
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
[InitializeOnLoad]
public class AsmdefDebug
{
@kalineh
kalineh / PrefabNode.cs
Created July 13, 2017 18:09
Simple nested prefab utility with editor preview.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor(typeof(PrefabNode))]
public class PrefabNodeEditor
: Editor
@ByronMayne
ByronMayne / AnimatedComponent.cs
Created May 29, 2017 11:17
The source code behind my Unity tip.
using UnityEngine;
using System.Collections;
// This is not need but I just wanted to make the point clear.
public class AnimatedComponent : MonoBehaviour
{
}
@unitycoder
unitycoder / Standard-2Sided-FixNormals.shader
Last active October 2, 2023 14:40
Standard Shader - 2 Sided (cull off) - Also, 2 Sided Standard Surface Shader with Fixed Normals
// 2 sided standard surface shader (using 2 passes), with fixed normals for flipped faces
Shader "Custom/TwoSided (FixedNormals)"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
@ElementalSpork
ElementalSpork / SimpleGeo.cs
Created July 14, 2016 03:51 — forked from phosphoer/SimpleGeo.cs
Simple Geometry Painter for Unity
// David Evans @phosphoer
// Feel free to use this in your commercial projects
// Let me know if you do cause it will make me feel good and stuff
using UnityEngine;
using System.Collections.Generic;
using System;
#if UNITY_EDITOR
using UnityEditor;
@phosphoer
phosphoer / SimpleGeo.cs
Last active March 28, 2024 22:24
Simple Geometry Painter for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
@phosphoer
phosphoer / GravityItem.cs
Last active May 27, 2023 19:54
Mario Galaxy Gravity for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR