Skip to content

Instantly share code, notes, and snippets.

View 8Observer8's full-sized avatar

Ivan 8Observer8

View GitHub Profile
@8Observer8
8Observer8 / main.py
Created November 16, 2025 16:20
Pygame and ModernGL. Move a camera with WASD and arrow keys
# pip install moderngl pygame numpy pyglm
from typing import Optional, Tuple
import glm
import moderngl
import numpy as np
import pygame as pg
# ---------------- TYPES ---------------- #
@8Observer8
8Observer8 / main.py
Created November 16, 2025 16:17
Pygame and ModernGL. Keep aspect of rectangle and text
# pip install moderngl pygame numpy pyglm
from typing import Optional, Tuple
import glm
import moderngl
import numpy as np
import pygame as pg
# ---------------- TYPES ---------------- #
@8Observer8
8Observer8 / .gitignore
Last active November 13, 2025 00:24
Background color using OpenGL, SDL3, and C
dist
public/js
@8Observer8
8Observer8 / main.py
Created November 12, 2025 18:22
Background color using OpenGL, Pygame, and Python
# pip install PyOpenGL Pygame
import pygame
from OpenGL.GL import *
from pygame.locals import *
def main():
pygame.init()
pygame.display.set_mode((350, 350), DOUBLEBUF | OPENGL)
@8Observer8
8Observer8 / main.py
Last active November 12, 2025 21:16
Background color using OpenGL, PySDL3, and Python
# pip install PyOpenGL PySDL3
import os
from OpenGL.GL import *
os.environ["SDL_MAIN_USE_CALLBACKS"] = "1"
os.environ["SDL_RENDER_DRIVER"] = "opengl"
import sdl3
@8Observer8
8Observer8 / create-prefab-aar.py
Created September 27, 2025 13:07 — forked from madebr/create-prefab-aar.py
Create Android prefab (.aar) archives for native CMake projects
#!/usr/bin/env python
import argparse
import glob
from io import BytesIO
import itertools
import json
import os
from pathlib import Path
import shlex
@8Observer8
8Observer8 / ,clang-format
Created May 19, 2025 14:38
.clang-format for C
---
Language: C
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
@8Observer8
8Observer8 / .clang-format
Last active March 31, 2025 18:41
.clang-format WebKit
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
@8Observer8
8Observer8 / hello-box2d-v2-cpp.cpp
Created February 8, 2025 20:30
Print gravity with Box2D 2.4.2
#include <box2d/box2d.h>
#include <iostream>
int main()
{
b2Vec2 gravity(0.f, -9.8f);
b2World* world = new b2World(gravity);
float gx = world->GetGravity().x;
float gy = world->GetGravity().y;
std::cout << "gravity = (" << gx << ", " << gy << ")" << std::endl;
@8Observer8
8Observer8 / debug_drawer.py
Last active December 2, 2024 11:43
PyBox2D collision detection using Pygame
import math
import pygame
from Box2D import b2Draw
class DebugDrawer(b2Draw):
def __init__(self, window, pixelsPerMeter, thickness=3):
super().__init__()