Skip to content

Instantly share code, notes, and snippets.

View kingcoyote's full-sized avatar

Steve Phillips kingcoyote

View GitHub Profile
#include <xc.h>
#include <pic18.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ws2812.h"
// subsystem structs
#ifndef WS2812_H
#define WS2812_H
typedef struct {
unsigned char r;
unsigned char b;
unsigned char g;
} ws2812_ptr;
// transmit a single WS2812
#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);
// 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
// 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;
// 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
#pragma config FOSC=HS1
_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);
<?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" />
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)
);