Skip to content

Instantly share code, notes, and snippets.

View gszauer's full-sized 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 / Tokenizer.cs
Created April 1, 2024 23:20
Tokenizer.cs
namespace Compiler {
public delegate void PrintErrorFunction(string message);
public class Location {
public string File { get; protected set; }
public int Line { get; protected set; }
public int Column { get; protected set; }
public Location(string file, int line, int column) {
File = file;
Line = line;
@gszauer
gszauer / trigapproximations.cpp
Created September 3, 2023 20:39
trigapproximations.cpp
// Trig approximations from: http://www.ganssle.com/approx.htm
#include <windows.h>
#include <cmath>
#include <iostream>
#include <iomanip>
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
@gszauer
gszauer / mousehandler.cpp
Created March 8, 2023 19:47
mousehandler.cpp
///////////////////////////////////////////////////////////////////////////
//
// MODULE: MOUSINFO.C
//
// DESCRIPTION: SDK sample for handling the WM_MOUSEWHEEL message and
// the TrackMouseEvent() API.
//
// Applet displays MouseButton, MouseWheel, MouseMovement, and
// any mouse messages in the title bar.
//
@gszauer
gszauer / memory.cpp
Created January 20, 2023 22:49
memory.cpp
#include "memory.h"
#if defined(MEM_PLATFORM_WINDOWS)
#include <windows.h>
mem_cfunc void PrintDebugString(const char* str) {
OutputDebugStringA(str);
}
#ifdef _DEBUG
#define MemInternal_Assert(cond) if (!(cond)) {*(u8*)0 = 0;}
@gszauer
gszauer / SimpleSound.cpp
Created December 1, 2022 21:20
Simple Sound
#include "SimpleSound.h"
#include <windows.h>
#include <atomic>
#include <dsound.h>
#include <iostream>
#undef PlaySound
#define SIMPLE_SOUND_MAX_CHANNELS 6
#define SIMPLE_SOUND_NUM_COMMANDS 512
@gszauer
gszauer / UI.js
Last active July 23, 2022 18:08
WebFS First Demo
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 {
@gszauer
gszauer / types.h
Created May 26, 2022 04:16
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 February 25, 2022 03:17
RecursiveDescentParser
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExpressionParser {
class ASTNode {
}
@gszauer
gszauer / MathParser.cs
Created February 14, 2022 08:46
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 October 14, 2021 02:19
PolygonRenderer
#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);