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
// gba.h by eloist | |
#ifndef GBA_HEADER | |
#define GBA_HEADER | |
typedef unsigned char u8; | |
typedef unsigned short u16; | |
typedef unsigned long u32; | |
typedef signed char s8; |
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
/* | |
* Main written by Seth Tenembaum beginning Jan 2, 2017 | |
* | |
* The purpose of this document is to come to a better understanding of the fundamentals of game developmeny by building a simple platformer from scratch at a low level (but not quite down to assembly at the moment). | |
* | |
* TODO | |
* - fix issue when holding left and right (actually not possible on physical hardware...) | |
* - subpixel positioning and detach movement speed from frame rate | |
* - add a single platform | |
* - implement a global coordinate system, array of platform positions and sizes, and a camera |
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
void drawPixel_mode4(int x, int y, u8 color) | |
{ | |
u16 *here = (REG_DISPCNT & BACKBUFFER ? VideoBuffer : BackBuffer) + x%(SCREEN_WIDTH/2) + y*(SCREEN_WIDTH/2); | |
*here = color + (*here & 0xFF00); | |
} | |
void drawRect_mode4(int x, int y, int w, int h, u8 c) | |
{ | |
u16 *currentBackBuffer = REG_DISPCNT & BACKBUFFER ? VideoBuffer : BackBuffer; | |
int ix, iy; |
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
p(x,y,c){(*(4<<24)&16?6<<24:0x600A<<12)+x%120+y*80=x%2==0?c+(((*(4<<24)&0x10?6<<24:0x600A<12)+x%120+y*80)&0xFF00):(u8)((*(4<<24)&0x10?6<<24:0x600A<<12)+x%120+y*80)+(c<<8);} | |
r(x,y,w,h,c){for(i=x/2-1;++i<(x+w+1)/2;)for(j=y-1;++j<y+h;)i*2==x-1?p(i+1,j,c):i*2==x+w-1?p(i,j,c):(*(4<<24)&16?6<<24:0x600A<<12)+i%120+j*80=c+(c<<8);} |
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
#include <Wire.h> | |
#include <EVShield.h> | |
// setup for this example: | |
// attach external power to EVShield. | |
// attach 2 motors to motor ports on Bank A | |
EVShield evshield(0x34,0x36); | |
void |
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 numpy as np | |
from PiStorms import PiStorms | |
def calibrate(psm): | |
def generateA(X,Y): | |
for (x,y) in zip(X,Y): | |
psm.screen.fillRect(x,y, 1,1, (255,0,0)) | |
while psm.isKeyPressed(): pass # wait until the button is released from a possible previous press | |
while not psm.isKeyPressed(): pass # wait until the key is pressed down again | |
tsX = int(psm.screen.RAW_X()) # mindsensors_i2c.readInteger should really already return an integer |
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
class A: | |
def __init__(self, param1): | |
print "Class A recieved a param1 of", param1 | |
class B(A): | |
def __init__(self, param1, param2): | |
super().__init__() | |
print "Class B for param1", param1, "param2", param2 | |
#a = A(111) |
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
admin@roboRIO-1086-FRC:~$ clcp_sd540c scan | |
{"scan":[10,12,13,15,16,17,18]} | |
admin@roboRIO-1086-FRC:~$ for id in 1{0,2,3,{5..8}}; do clcp_sd540c $id name; done | |
status: 0 | |
{"name":"GreenTen"} | |
status: 0 | |
{"name":"YellowTw"} | |
status: 0 | |
{"name":"GreenThi"} | |
status: 0 |
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
from PiStorms import PiStorms | |
psm = PiStorms() | |
psm.screen.drawDisplay('Raw touchscreen vals') | |
psm.screen.termPrintAt(8, 'Press GO to quit.') | |
while not psm.isKeyPressed(): | |
psm.screen.termPrintAt(0, 'X: %d' % psm.screen.TS_X()) | |
psm.screen.termPrintAt(1, 'Y: %d' % psm.screen.TS_Y()) |
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
//: Playground - noun: a place where people can play | |
var n = 61 | |
var isPrime = true | |
//for var factor = 2; factor < n; factor++ { | |
for factor in stride(from: 2, to: n/2, by: 2) { | |
if n % factor == 0 { | |
isPrime = false | |
break |