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 <xc.h> | |
#include <pic18.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include "ws2812.h" | |
// subsystem structs |
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
#ifndef WS2812_H | |
#define WS2812_H | |
typedef struct { | |
unsigned char r; | |
unsigned char b; | |
unsigned char g; | |
} ws2812_ptr; | |
// transmit a single WS2812 |
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 <xc.h> | |
#include <pic18.h> | |
#include <stdlib.h> | |
#include "ws2812.h" | |
// the pin that the LEDs are on. I don't like this being in here | |
// but timing is so tight, it is hard to put it elsewhere | |
#define PIN PORTBbits.RB1 | |
unsigned long int bitflip(unsigned char b); |
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 the XC and PIC18 libraries | |
#include <xc.h> | |
#include <pic18.h> | |
#pragma config FOSC=HS1 | |
// timer that will increment 4 times per second | |
unsigned long int timer; | |
// main loop of the program |
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
// interrupt service routine to handle all interrupts | |
void interrupt main_isr(void) { | |
// if Timer 0's interrupt flag has been raised | |
if (TMR0IF) { | |
// increment the millisecond counter | |
milliseconds++; | |
// set the Timer 0 value to 65536 - 2000 = 63536 | |
TMR0 = 63536; | |
// lower the interrupt flag | |
TMR0IF = 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
// include the XC and PIC18 libraries | |
#include <xc.h> | |
#include <pic18.h> | |
#pragma config FOSC=HS1 | |
// number of milliseconds that the device has been on | |
unsigned long int milliseconds; | |
// main loop of the program |
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
#pragma config FOSC=HS1 |
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
_cannonButton = new ImageButtonControl(); | |
_cannonButton.Bounds = new UniRectangle( | |
new UniScalar(0.0F, 15), | |
new UniScalar(0.0F, 15), | |
new UniScalar(0.0F, 50), | |
new UniScalar(0.0F, 50) | |
); | |
_cannonButton.ImageFrame = "hotbar.cannon"; | |
Children.Add(_cannonButton); |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<skin | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="skin.xsd" | |
name="MenuSkin" | |
> | |
<resources> | |
<font name="menu_font" contentPath="menu_font" /> | |
<bitmap name="menu_skin_bitmap" contentPath="menu_skin" /> |
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
Gui = new GuiManager(Game.Graphics, Game.Input) | |
{ | |
Screen = new Screen(game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height) | |
}; | |
Gui.Screen.Desktop.Bounds = new UniRectangle( | |
25, 25, | |
new UniScalar(1.0f, -25.0F), new UniScalar(1.0f, -25.0F) | |
); |
NewerOlder