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 / prompt.txt
Created April 10, 2025 17:18
Object Rotator Prompt
Write a c++ class that rotates an object in 3d space. The camera is orthographic and a fixed distance away, you can only rotate the object.
Rotation should have smooth interpolation, giving it a mobile friendly feel.
smooth interpolation (even while draggin) is a must! The y axis should not be inverted.
This is NOT an arcball it needs to work anywhere the screen is touched. Go with a physics approach like a spring model rather than an arcball.
Take things like large or fast inputs, as well as suddent stops in input into account, and keep rotation smooth always. DAMPEN
This is the class you are implementing:
class ObjectRotator {
public:
@gszauer
gszauer / OpenGLInitWin32.cpp
Last active December 25, 2024 22:44
OpenGLInitWin32.cpp
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ShellScalingAPI.h> // Shcore.lib
#include "glad.h" // OpenGL32.lib
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
#define WINDOW_CLASS "OGL_Sample"
#define WINDOW_TITLE "OpenGL Sample"
@gszauer
gszauer / UITree.js
Last active September 30, 2024 06:32
TreeTest
if (document.GenUUID === undefined) {
document.GenUUID = () => {
const guid = "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
(+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16)
);
return guid;
};
}
@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;