Skip to content

Instantly share code, notes, and snippets.

@kadir014
kadir014 / imgui_with_moderngl_pygame.py
Created August 10, 2025 12:43
Minimal imgui, moderngl and pygame with minimal dependencies.
"""
Minimal implementation of ImGUI using ModernGL and Pygame(-CE) requiring minimal dependencies.
# TODO:
- Better font handling?
- Key press events.
- Framebuffer scaling.
"""
from typing import Optional
@kadir014
kadir014 / pygbag_build_custom_wheel.md
Created April 5, 2025 21:32
Build your own third-party pygbag wheels

Introduction

These are the steps I use to build Nova Physics's Python Binding for pygbag. Hope it helps you build your own third-party pygbag wheels 💕

Prerequisites

  • Ubuntu 22 (or higher) WSL works as well. (glibc 2.35+ is required.)

Building

  • Be in the root directory (we will extract stuff into /opt).

  • Download the latest python-wasm-sdk release from here. (I had to download a slightly older release.)

from dataclasses import dataclass
import numpy
import pygame
from pygame import Vector2
WINDOW_WIDTH = 500
WINDOW_HEIGHT = 400
MAX_FPS = 60
from heat2d import *
engine = Engine()
engine.window.title = "Heat2D UI Testing"
engine.window.clear_color = (255, 255, 255)
class Mario(GameObject):
def __init__(self):
super().__init__()
@kadir014
kadir014 / fadehandler.py
Created January 26, 2020 16:23
Fade effect for pygame
import pygame
display = None
fade_surface = None
tick = 0
speed = 10
anim_state = None
anim_func = None
def init():
@kadir014
kadir014 / draw_dashed.py
Last active December 17, 2019 07:46
Dashed lines in Pygame
import pygame
from math import hypot
class Point:
def __init__(self, point):
self.x = point[0]
self.y = point[1]
def __add__(self, other):