Mon Sep 05, 2016 9:04 pm
#include <Gamebuino.h>
#include <SPI.h>
Gamebuino gb;
byte x = 0;
byte y = 0;
void setup() {
gb.begin();
gb.titleScreen(F("Paint DEMO"));
gb.display.persistence = true;
gb.display.clear();
} //setup END
void loop() {
if (gb.update()) {
if (gb.buttons.pressed(BTN_C)) {
gb.titleScreen(F("Paint DEMO"));
} // if (gb.buttons.pressed(BTN_C)) END
if (gb.buttons.pressed(BTN_DOWN)) {
y += 1;
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_UP)) {
y -= 1;
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_LEFT)) {
x -= 1;
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_RIGHT)) {
x += 1;
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_B)) {
gb.display.clear();
}
gb.display.drawPixel(x, y);
} //if (gb.update()) END
} //loop END
Thu Sep 29, 2016 3:52 pm
Thu Sep 29, 2016 10:28 pm
Fri Sep 30, 2016 3:05 pm
Fri Sep 30, 2016 3:32 pm
#include <Gamebuino.h>
#include <SPI.h>
Gamebuino gb;
boolean penDown = false;
byte x = 0;
byte y = 0;
void setup() {
gb.begin();
gb.titleScreen(F("Paint DEMO"));
gb.display.persistence = true;
gb.display.clear();
} //setup END
void loop() {
if (gb.update()) {
if (gb.buttons.pressed(BTN_C)) {
gb.titleScreen(F("Paint DEMO"));
} // if (gb.buttons.pressed(BTN_C)) END
if (gb.buttons.pressed(BTN_DOWN)) {
y += 1;
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_UP)) {
y -= 1;
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_LEFT)) {
x -= 1;
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_RIGHT)) {
x += 1;
//gb.display.drawFastVLine(x, y, 1);
}
// Use button A to switch between pen up & down modes
if (gb.buttons.pressed(BTN_A)) {
penDown = !penDown;
}
// If pen is down then pressing button B pulls it up
if (gb.buttons.pressed(BTN_B)) {
gb.display.clear();
}
if (penDown) {
gb.display.drawPixel(x, y);
}
} //if (gb.update()) END
} //loop END
Sat Oct 01, 2016 10:39 pm
Sun Oct 02, 2016 7:51 pm
#include <Gamebuino.h>
#include <SPI.h>
Gamebuino gb;
byte x = 0;
byte y = 0;
//char coords[7] = "84,48";
boolean penDown = false;
void setup() {
gb.begin();
gb.titleScreen(F("Paint DEMO"));
gb.display.persistence = true;
gb.display.clear();
//gb.setFrameRate(10);
} //setup END
void loop() {
//gb.display.clear();
gb.display.persistence = true;
if (gb.update()) {
if (gb.buttons.pressed(BTN_C)) {
x = 0;
y = 0;
gb.titleScreen(F("Paint DEMO"));
} // if (gb.buttons.pressed(BTN_C)) END
if (gb.buttons.pressed(BTN_DOWN)) {
y += 1;
if (y == 48) {
y = 47;
}
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_UP)) {
y -= 1;
if (y == 255) {
y = 0;
}
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_LEFT)) {
x -= 1;
if (x == 255) {
x = 0;
}
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_RIGHT)) {
x += 1;
if (x == 84) {
x = 83;
}
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_B)) {
gb.display.clear();
x = 0;
y = 0;
}
// Use button A to switch between pen up & down modes
if (gb.buttons.pressed(BTN_A)) {
penDown = !penDown;
}
// If pen is down then pressing button B pulls it up
if (gb.buttons.pressed(BTN_B)) {
gb.display.clear();
}
if (penDown) {
gb.display.drawPixel(x, y);
}
//gb.display.drawPixel(x, y);
} //if (gb.update()) END
} //loop END
Sun Oct 02, 2016 8:43 pm
#include <Gamebuino.h>
#include <SPI.h>
Gamebuino gb;
byte x = 0;
byte y = 0;
//char coords[7] = "84,48";
boolean penDown = true;
const byte drawPixelHere[] PROGMEM = {
8,3,
0x40,
0xA0,
0x40,
};
const byte emptyPixel[] PROGMEM = {
8,3,
0x0,
0x0,
0x0,
};
void setup() {
gb.begin();
gb.titleScreen(F("Paint DEMO"));
gb.display.persistence = true;
gb.display.clear();
//gb.setFrameRate(10);
} //setup END
void loop() {
if (gb.update()) {
// If pen is down then pressing button C pulls it up
if (gb.buttons.pressed(BTN_C)) {
x = 0;
y = 0;
gb.titleScreen(F("Paint DEMO"));
gb.display.clear();
gb.display.persistence = true;
} // if (gb.buttons.pressed(BTN_C)) END
if (gb.buttons.pressed(BTN_DOWN)) {
y += 1;
if (y == 48) {
y = 47;
}
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_UP)) {
y -= 1;
if (y == 255) {
y = 0;
}
//gb.display.drawFastHLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_LEFT)) {
x -= 1;
if (x == 255) {
x = 0;
}
//gb.display.drawFastVLine(x, y, 1);
}
if (gb.buttons.pressed(BTN_RIGHT)) {
x += 1;
if (x == 84) {
x = 83;
}
//gb.display.drawFastVLine(x, y, 1);
}
// Use button A to switch between pen up & down modes
if (gb.buttons.pressed(BTN_A)) {
penDown = !penDown;
}
// If pen is down then pressing button B pulls it up
if (gb.buttons.pressed(BTN_B)) {
x = 0;
y = 0;
gb.display.clear();
}
if (penDown) {
gb.display.drawPixel(x, y);
} else {
//gb.display.drawBitmap(x - 1, y - 1, drawPixelHere);
}
//gb.display.drawPixel(x, y);
} //if (gb.update()) END
} //loop END
Tue Oct 11, 2016 6:13 am