Skip to content

Instantly share code, notes, and snippets.

View petrocket's full-sized avatar
💥
Trying not to cross the streams

Alex Peterson petrocket

💥
Trying not to cross the streams
View GitHub Profile
@petrocket
petrocket / GameKeyboard.mm
Last active August 29, 2015 13:57
Game Keyboard Implementation
using namespace std;
map <char, OIS::KeyCode> createKeyMap() {
map<char, OIS::KeyCode> m;
m['a'] = OIS::KC_A;
m['b'] = OIS::KC_B;
m['c'] = OIS::KC_C;
m['d'] = OIS::KC_D;
m['e'] = OIS::KC_E;
m['f'] = OIS::KC_F;
@petrocket
petrocket / GameKeyboard.h
Last active August 29, 2015 13:57
Game Keyboard Header
@interface GameKeyboard : NSObject<UITextFieldDelegate>
@property (nonatomic, strong) UITextField *textField;
+ (GameKeyboard *)sharedInstance;
@end
@petrocket
petrocket / GameAudioInterface.h
Created April 2, 2014 00:17
Game Audio Interface Header
void playBackgroundMusic(std::string filename);
void stopBackgroundMusic();
unsigned int playEffect(std::string filename);
unsigned int playEffect(std::string filename,float pitch, float pan, float gain);
@petrocket
petrocket / GameAudio.mm
Last active August 29, 2015 13:57
Game Audio Implementation
@implementation GameAudio
void playBackgroundMusic(std::string filename)
{
[SimpleAudioEngine sharedEngine].backgroundMusicVolume = 0.25;
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:[NSString stringWithCString:filename.c_str() encoding:[NSString defaultCStringEncoding]]];
}
void stopBackgroundMusic()
{