Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Living life 16.6 ms at a time

Gabor Szauer gszauer

💻
Living life 16.6 ms at a time
View GitHub Profile
@gszauer
gszauer / UI.js
Last active Jul 23, 2022
WebFS First Demo
View UI.js
function UpdateMetaData(WebFS, info) {
let infoDiv = document.getElementById('size');
//let location = window.location.href;
let location = (new URL(window.location.href));
let target = "filesystem:" + location.protocol;
if (target.endsWith(":")) {
target += "//";
}
else {
View types.h
#pragma once
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef __int8 i8;
typedef __int16 i16;
typedef __int32 i32;
@gszauer
gszauer / ASTNode.cs
Created Feb 25, 2022
RecursiveDescentParser
View ASTNode.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExpressionParser {
class ASTNode {
}
View MathParser.cs
// <expression> -> <term> (("+" | "-") <term>)*
// <term> -> <power> (("*" | "/") <power>)*
// <power> -> <unary> ("^" <power>)*
// <unary> -> ("-")? <unary> | <factor>
// <factor> -> NUMBER | "(" <expression> ")"
class Program {
public static void Main(String[] args) {
Program p = new Program("3");
Console.ReadLine();
@gszauer
gszauer / Polygon.cpp
Created Oct 14, 2021
PolygonRenderer
View Polygon.cpp
#include "Polygon.h"
#include <list>
#include <algorithm>
#include <bitset>
#include <vector>
#include <list>
void DrawPixel(int x, int y, unsigned char r, unsigned char g, unsigned char b);
void DrawPixel(int x, int y, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
View PolyRasterV0.cpp
#include "PolyRasterV0.h"
#include <cmath>
#include <iostream>
namespace Rasterizer {
void raster_polygon_assert(bool b) {
if (!b) {
*((u8*)0) = 42;
}
}
@gszauer
gszauer / Font.cpp
Last active Jun 22, 2022
Minimal ttf parser and rasterizer
View Font.cpp
#define _CRT_SECURE_NO_WARNINGS
#include "Font.h"
#include <tuple>
using std::vector;
using std::tuple;
using std::get;
void DrawPixel(i32 x, i32 y, u8 r, u8 g, u8 b);
View Line.cpp
#include "Line.h"
#include <cmath>
#include <iostream>
inline int max(int a, int b) {
if (a > b) {
return a;
}
return b;
}
@gszauer
gszauer / gameplay::Animation.md
Last active Aug 20, 2020
gameplay3d::Animation breakdown
View gameplay::Animation.md

Core classes

Animation.h

class Animation

Defines a generic property animation. To run an animation you must play an AnimationClip. Every Animation has the default clip which will run from begin-end time. You can create additional clips to run only parts of an animation and control various runtime characteristics, such as repeat count, etc.

TODO: Fill ouy with own words

@gszauer
gszauer / CurveExplorer
Created Jul 28, 2020
Explore Unity Curves
View CurveExplorer
using System.Collections;
using UnityEngine;
using UnityEditor;
public class CurveExplorer : MonoBehaviour
{
public AnimationCurve curve;
[MenuItem("CONTEXT/CurveExplorer/Copy Data")]
static void CopyCurveInfo(MenuCommand command)