navigationGo.pngQuick Navigation
allprojects32.pngAll projects
hardware32.pngHardware
links32.pngLinks

favoriteStar32.pngTop projects
Alan numitron clock
Clapclap 2313/1386
SNES Pi Webserver
USB Volume/USB toys
Smokey amp
Laser cutter
WordClock
ardReveil v3
SNES Arcade cabinet
Game boy projects
cameleon
Home Presence Detector

github32.pngGitHub
AlanFromJapan

navigationMail.pngContact me

alanfjmail.png
3flags.pngWho's Alan?


Akizukidenshi
Elec-lab
Rand Nerd Tut
EEVblog
SpritesMods
Switch-science
Sparkfun
Suzusho
Datasheet Lib
Reddit Elec
Ermicro
Carnet du maker (fr)
Marutsu
ATmel blog (defunct)

touchslideext

kalshagar - TouchSlideExt

TouchSlideExt library

Adds some functionalities to my TouchSlide project without changing the kernel or coding in your program again and again.

Current version
0.1
Current version release date
19/07/2009
Current version release
  • Many stuffs (see under)
    • Image utility
    • Screen saver
    • Buttons management
  • ...
  • Works fine (^o^)v
Current version bin/src
Source

Structure

  • TouchSlideExt.h : types and signatures
    • TouchSlideExt.cpp : some functions for images in the memory (list known, show one by one, show by index,...)
    • ScreenSaver_Bees.cpp : a screen saver with bees (little flying '%20')
    • ScreenSaver_Boxes.cpp : a screen saver with bouncing boxes
    • ARDTButtons.cpp : TouchSlide button management, drawing, definition... (see under)
    • ARDTButtonsPanels.cpp : extension of the above, manages the Panels (set of buttons) and add MVC (Model-View-Controlled) like navigation, plus confirmation screens and all the panels definitions (see under)

ARDTButtons.cpp

///////////////////////////////////////////////////////////////////////////////////
// Structures
//ARDTButton struct definition
//uses char* to save space : no need to copy the text here, referencing it in the string zone is sufficient (no change)
typedef struct {
  byte attributes; //see under
  RECT rect; //wether fixed or not, this is where the button has been drawn
  char* label; //label of the button (displayed in info bar)
  char code; //code that will be sent to the PC
  long bgcolor; //background color (coded on a long)
  long forecolor; //text color (coded on a long)
  byte imageIndex; //255: it's a text button, 254 : image by name, otherwise the index of the image
  char* imageName; //if it is a image button by name, the name of the image
} ARDTButton;
 
#define BUTTON_ATTRIBUTE_AUTOPOSITION 1
#define BUTTON_ATTRIBUTE_HASBORDER 2
#define BUTTON_ATTRIBUTE_HASCONFIRMATION 4
#define BUTTON_ATTRIBUTE_BGGRADIENT 8
#define BUTTON_ATTRIBUTE_NOPADDING 16 //dont make smaller to keep some space around the button
 
//Buttons management
#define BUTTONS_COUNT 20 //max number of buttons allowed on one screen

Each button has the following structure. CURRENT buttons are kept in a array of BUTTONS_COUNT length. Some functions give you the number of buttons, access to the array, etc. Buttons can be with an image or with color and text. One button can be defined as DisplayLabel : use this one to display text or message on the screen instead of writing somewhere: use the showMessage().
Most useful functions :
///////////////////////////////////////////////////////////////////////////////////
// Buttons
ARDTButton* getAllButtons ();
ARDTButton* getDisplayLabel ();
byte getAllButtonsCount ();
 
//Draws a button
void drawARDTButton (ARDTButton& pButton);
//draw all
void drawAllButtons();
//Shows a text in the text zone
void showMessage(char* pS);
void showMessage(char* pS, byte pFontSize);
 
//Returns the button that is at a given coordinate
ARDTButton* getButtonAt (Point p);

ARDTButtonsPanels.cpp

Panel is a set of buttons that work together. Each panel has a unique id. You can navigate by asking to go to a special panel. Some special panel exist such as the PANEL_YESNO that is used to ask for confirmation by showConfirmMessage().

///////////////////////////////////////////////////////////////////////////////////
// Panels
//moves to a defined panel
void gotoPanel(byte pPanelId);
//moves to a defined panel
bool showConfirmMessage(char* pMessage);
//gets the id of the current panel
byte getCurrentPanel() ;
All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated)
electrogeek.cc ~ Formerly known as Kalshagar.wikispaces.com (AlanFromJapan [2009 - 2019])