This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| from pyglm.glm import vec2, vec3, vec4 | |
| from pyglm import glm | |
| def to_screen(point: vec2, screen_v: vec2) -> vec2: | |
| """ | |
| ndc (-1, 1) to actual screen coords (0, width), (0, height) | |
| """ | |
| n = (point + 1) / 2 # (0, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| from ast import BinOp, Add, Sub, Mult, Div, Mod, Constant, Tuple | |
| import ast | |
| import re | |
| class Dice(Constant): | |
| pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess, json | |
| def parse_json_dynamic(stream): | |
| dec = json.JSONDecoder() | |
| buf = '' | |
| for chunk in stream: | |
| buf += chunk | |
| while True: | |
| try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| from dataclasses import dataclass | |
| from collections import deque | |
| import pygame | |
| from pygame import Vector2 | |
| @dataclass | |
| class Circle: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| # direction normals | |
| LEFT = pygame.Vector2(-1, 0) | |
| RIGHT = pygame.Vector2(1, 0) | |
| UP = pygame.Vector2(0, -1) | |
| DOWN = pygame.Vector2(0, 1) | |
| ZERO = pygame.Vector2(0, 0) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| from typing import Callable, Any, NamedTuple | |
| import select | |
| import heapq | |
| import time | |
| class Schedule(NamedTuple): | |
| when: float |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| from pygame import Vector2 | |
| from dataclasses import dataclass | |
| @dataclass | |
| class Tile: | |
| name: str | |
| image: pygame.Surface | |
| position: Vector2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| from pygame import Vector2 | |
| import pygame | |
| import math | |
| @dataclass | |
| class Circle: | |
| center: Vector2 | |
| radius: float |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| from platformdirs import PlatformDirs | |
| __all__ = ['path'] | |
| app_dirs = PlatformDirs('AppName', 'AppAuthor') # change this | |
| here = Path(__file__).absolute().parent | |
| SCHEMES = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Self | |
| import math | |
| import io | |
| type Number = int | float | |
| type TVec = tuple[Number, Number] | |
| class Vector: | |
| repr_precision = 6 |
NewerOlder