Skip to content

Instantly share code, notes, and snippets.

View pvcraven's full-sized avatar

Paul V Craven pvcraven

View GitHub Profile
import arcade
import math
from dataclasses import dataclass
from typing import Callable
from typing import Tuple
SPRITE_SCALING = 0.5
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
"""
"""
import arcade
WIDTH = 800
HEIGHT = 600
"""
Sprite Collect Coins
Simple program to show basic sprite usage.
Artwork from http://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_collect_coins
"""
import random
import arcade
import os
import pyglet
import pyglet.gl as gl
# --- Constants ---
SPRITE_SCALING_PLAYER = 0.5
SPRITE_SCALING_COIN = .25
COIN_COUNT = 50
@pvcraven
pvcraven / gist:fd8a7492e4e67f9c75dfeb66954acaca
Last active March 28, 2020 18:45
Modern GL and frame buffer work
import numpy as np
import moderngl
from moderngl_window import geometry
from ported._example import Example
from pathlib import Path
import os
class SimpleColorTriangle(Example):
gl_version = (3, 3)
aspect_ratio = 16 / 9
import numpy
import time
import ctypes
LIST_SIZE = 100_000
CYCLE_COUNT = 100
def test_native():
my_list = [0 for i in range(LIST_SIZE)]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
from PIL import Image
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import TypeVar
import time
import collections
import math
import random
@pvcraven
pvcraven / lint_example.py
Last active June 21, 2017 18:35
What is the proper way to do this code, so a linter does not see an error?
from typing import Iterable
from typing import TypeVar
from typing import Generic
"""
This is the API section.
The user should not be changing this part of the code.
"""