This file contains 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
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c | |
index b4ad6c7..2d50486 100644 | |
--- a/src/audio/SDL_wave.c | |
+++ b/src/audio/SDL_wave.c | |
@@ -445,7 +445,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, | |
} | |
/* 2 Uint32's for chunk header+len, plus the lenread */ | |
headerDiff += lenread + 2 * sizeof(Uint32); | |
- } while ( (chunk.magic == FACT) || (chunk.magic == LIST) ); | |
+ } while ( (chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT) ); |
This file contains 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
#!/usr/bin/env python | |
# like the testsprite.c that comes with sdl, this pygame version shows | |
# lots of sprites moving around. | |
import pygame, sys, os | |
from pygame.locals import * | |
from random import randint | |
from time import time | |
import gc | |
import pygame.joystick |
This file contains 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
""" Shows how to use flask and matplotlib together. | |
Shows SVG, and png. | |
The SVG is easier to style with CSS, and hook JS events to in browser. | |
python3 -m venv venv | |
. ./venv/bin/activate | |
pip install flask matplotlib | |
python flask_matplotlib.py | |
""" |
This file contains 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
""" | |
Show a light for every beat. | |
Show the BPM as text. | |
Use 4/4 timing. Four beats to a bar. | |
Press space until the BPM gets to what you want. | |
""" | |
import time | |
import os | |
import pygame as pg |
This file contains 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
#!/usr/bin/env python | |
import pygame | |
import math | |
def draw_aacircle(surface, color, pos, radius, width=0): | |
r, g, b = color | |
position_x, position_y = pos | |
alpha_max = 255 |
This file contains 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
""" Run a task in a background thread. | |
python3 -m pip install tornado --user | |
python3 tornado_thread.py | |
curl http://localhost:8888/2 | |
See `run_on_executor` documentation: | |
https://www.tornadoweb.org/en/stable/concurrent.html#tornado.concurrent.run_on_executor | |
See for another approach: |
This file contains 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
""" headless pygame (without a window) playing two sounds one after the other. | |
""" | |
import os, sys, time | |
import pygame | |
import pygame.examples | |
# a pretend video. | |
os.environ["SDL_VIDEODRIVER"] = "dummy" |
This file contains 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.locals import * | |
pygame.init() | |
RES=(160, 120) | |
FPS=30 | |
clock = pygame.time.Clock() |
This file contains 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
--- src/video/cocoa/SDL_cocoavideo.h.orig Sat Jul 27 20:21:42 2019 +0200 | |
+++ src/video/cocoa/SDL_cocoavideo.h Tue Jul 30 10:04:46 2019 -0700 | |
@@ -113,9 +113,8 @@ | |
/* Utility functions */ | |
extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); | |
-/* Fix build with the 10.10 SDK */ | |
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101100 | |
-#define NSEventSubtypeTouch NSTouchEventSubtype | |
+/* Fix build with the 10.11 SDK */ |
This file contains 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
# midimusic.py | |
# curl -O https://upload.wikimedia.org/wikipedia/commons/5/55/MIDI_sample.mid | |
import time, sys, pygame | |
pygame.mixer.init() | |
pygame.mixer.music.load('MIDI_sample.mid') | |
pygame.mixer.music.play() | |
while pygame.mixer.music.get_busy(): | |
print('Still playing :)') |