![]() ![]() ![]() ![]() ![]() 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 ![]() AlanFromJapan ![]() ![]() ![]() Akizukidenshi Elec-lab Rand Nerd Tut EEVblog SpritesMods AvrFreaks Gameboy Dev FLOZz' blog Switch-science Sparkfun Suzusho Datasheet Lib Reddit Elec Ermicro Carnet du maker (fr) |
TouchSlideExtLast update: Thu Jun 5 22:25:41 2025
TouchSlideExt libraryAdds some functionalities to my TouchSlide project without changing the kernel or coding in your program again and again.
Structure
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.cppPanel 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.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025]) |