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 / mousehandler.cpp
Created March 8, 2023 19:47
mousehandler.cpp
View 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
View 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
View SimpleSound.cpp
#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
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 {
@gszauer
gszauer / types.h
Created May 26, 2022 04:16
types.h
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 February 25, 2022 03:17
RecursiveDescentParser
View ASTNode.cs
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
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 October 14, 2021 02:19
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);
@gszauer
gszauer / PolyRasterV0.cpp
Created September 13, 2021 00:11
PolygonRasterizer
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 February 5, 2023 22:49
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);