Skip to content

Instantly share code, notes, and snippets.

View EncodeTheCode's full-sized avatar
💭
Coding useful tools for workflow.

EncodeTheCode

💭
Coding useful tools for workflow.
View GitHub Profile
# Images should be 500x250 PNG format with transparency. Take into account (X:115, Y:81) reference M-16 position on screen, does not match up with PyGame measurements, adjust accordingly.
import pygame
import sys
# --- Configuration ---
SCREEN_SIZE = (800, 600)
BG_COLOR = (30, 30, 30)
FPS = 60
import pygame
import os
# --- Config ---
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
TWEEN_DISTANCE = 35
TWEEN_SPEED = 1 # pixels per frame
WEAPON_FOLDER = "wpn"
SWITCH_DELAY = 250 # ms delay for weapon swap
import pygame
import os
# --- Config ---
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
TWEEN_DISTANCE = 30
TWEEN_SPEED = 2 # pixels per frame
WEAPON_FOLDER = "wpn"
SWITCH_DELAY = 300 # ms delay for weapon swap
import os, time
from pygame._sdl2 import mixer
class AudioEngine:
Q={'low':(11025,-8,1,512),'medium':(22050,-16,1,1024),'high':(44100,-16,2,2048),'ultra':(48000,-16,2,4096)}
def __init__(self, quality='high'):
if quality not in self.Q: raise ValueError
f=self.Q[quality]; mixer.init(*f)
def find_file(self,b,exts):
import os, time
from pygame._sdl2 import mixer as m
class AE:
Q={'low':(11025,-8,1,512),'medium':(22050,-16,1,1024),'high':(44100,-16,2,2048),'ultra':(48000,-16,2,4096)}
def __init__(self,q='high'):
f=self.Q[q];m.init(f[0],f[1],f[2],f[3])
def f(self,b,exts):
for e in exts:
n=f"{b}.{e}"
import os
import time
import pygame._sdl2.mixer as mixer
class AudioEngine:
AUDIO_QUALITIES = {
"low": {
"frequency": 11025,
"size": -8,
"channels": 1,
import os
import time
import pygame._sdl2.mixer as mixer
# === Audio Quality Presets ===
AUDIO_QUALITIES = {
"low": {
"frequency": 11025,
"size": -8,
"channels": 1,
// stb_image_wrapper.c - Safe, optimized stb_image DLL interface
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#ifdef __cplusplus
extern "C" {
#endif
// -----------------------------
import ctypes
from ctypes import (
c_char_p, c_wchar_p, c_int, c_ubyte, c_ushort, c_float,
POINTER, c_void_p
)
import os
import platform
import sys
# ---------- Load DLL ----------
import heapq
import re
import numpy as np
from OpenGL.GL import *
from stb import image
# === Global registries & ID recycling heap ===
_images = {} # auto-named images
_named_images = {} # user-named images
_next_id = 1