Skip to content

Commit

Permalink
Some more UI testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
gniezen committed Aug 26, 2014
1 parent 6d8c398 commit a69e490
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 8 deletions.
File renamed without changes
7 changes: 7 additions & 0 deletions uitest/assets/default_assets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#define LOAD_ASSETS() GD.safeload("syringe.pic");
#define SYRINGE_HANDLE 0
#define SYRINGE_WIDTH 110
#define SYRINGE_HEIGHT 50
#define SYRINGE_CELLS 1
#define ASSETS_END 11000UL
static const shape_t SYRINGE_SHAPE = {0, 110, 50, 0};
3 changes: 3 additions & 0 deletions uitest/assets/icon_20561.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ui/assets/makeAssets.py → uitest/assets/makeAssets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ def addall(self):
spinner = gd2.prep.split(90, 30, Image.open("720.png"))
self.load_handle("SPINNER", spinner, gd2.ARGB1555)

self.load_handle("SYRINGE",Image.open("syringe.png"),gd2.ARGB4)

if __name__ == '__main__':
Spinner().make()
4 changes: 3 additions & 1 deletion ui/assets/makeAssets.py~ → uitest/assets/makeAssets.py~
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import gameduino2 as gd2
class Spinner(gd2.prep.AssetBin):

def addall(self):
spinner = gd2.prep.split(30, 90, Image.open("720.png"))
spinner = gd2.prep.split(90, 30, Image.open("720.png"))
self.load_handle("SPINNER", spinner, gd2.ARGB1555)

self.load_handle("SYRINGE",Image.open("syringe.png"),gd2.ARGB1555)

if __name__ == '__main__':
Spinner().make()
File renamed without changes.
Binary file added uitest/assets/syringe.pic
Binary file not shown.
Binary file added uitest/assets/syringe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions uitest/default_assets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#define LOAD_ASSETS() GD.safeload("syringe.pic");
#define SYRINGE_HANDLE 1
#define SYRINGE_WIDTH 110
#define SYRINGE_HEIGHT 50
#define SYRINGE_CELLS 1
#define ASSETS_END 11000UL
static const shape_t SYRINGE_SHAPE = {0, 110, 50, 0};
53 changes: 53 additions & 0 deletions uitest/icon_20561.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions ui/spinner_assets.h → uitest/spinner_assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ static const PROGMEM prog_uchar __assets[2026] = {
141, 9, 51, 141, 65, 50, 111, 38, 204, 54, 199, 248, 47, 232, 3, 158,
171
};
#define LOAD_ASSETS() GD.copy(__assets, sizeof(__assets))
#define SPINNER_HANDLE 0
#define SPINNER_WIDTH 90
#define SPINNER_HEIGHT 30
#define SPINNER_CELLS 12
#define ASSETS_END 64800UL
static const shape_t SPINNER_SHAPE = {0, 90, 30, 0};
#define SPIN_LOAD_ASSETS() GD.copy(__assets, sizeof(__assets))
#define SPIN_SPINNER_HANDLE 0
#define SPIN_SPINNER_WIDTH 90
#define SPIN_SPINNER_HEIGHT 30
#define SPIN_SPINNER_CELLS 12
#define SPIN_ASSETS_END 64800UL
static const shape_t SPIN_SPINNER_SHAPE = {0, 90, 30, 0};
Binary file added uitest/syringe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions uitest/ui.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <EEPROM.h>
#include <SPI.h>
#include <GD2.h>

#include "spinner_assets.h"
#include "default_assets.h"

int i = 0;

void setup()
{
GD.begin();
SPIN_LOAD_ASSETS();
LOAD_ASSETS();
}

void loop()
{
//GD.ClearColorRGB(0x103000);
GD.Clear();
GD.cmd_text(240, 68, 31, OPT_CENTER, "56.7 mL/h");

/*
GD.Begin(POINTS); // draw 50-pixel wide green circles
GD.ColorRGB(20, 91, 71);
GD.PointSize(50 * 16);
GD.BlendFunc(SRC_ALPHA, ONE);
// additive blending
for (int x = 100; x <= 380; x += 40)
GD.Vertex2ii(x, 200);
*/

GD.Begin(BITMAPS);
GD.Vertex2ii(240, 110, SPIN_SPINNER_HANDLE, floor(i / 10));
i += 1;
if(i>110)
i = 0;

GD.Vertex2ii(100, 200, SYRINGE_HANDLE);

GD.swap();
}

0 comments on commit a69e490

Please sign in to comment.