New TFT Extension Library

@cyclegadget
Yea, I can make that, in fact I think I already did, but I didn't make it into a library function.

I will add it to the list.

UPDATE:

Functions added:
rounded_Square :: robtillaart
drawMoon :: robtillaart
smiley_Face :: robtillaart
HourGlass :: robtillaart
SpeechBubble :: robtillaart

drawGauge :: cyclegadget

My own new functions:
Triangle : Bare basic make-a-triangle function
fillPoly : Basically a fill triangle function
drawOvalArc : See the example sketch, MoonLightPark

I moved the variable Thickness next to radius in both TouchArc and drawArc.
Polygon and drawStar now are able to be filled

And I am still working on making the SpeechBubble have multiple lines of text.

If anyone has anymore ideas for functions they would like to add to the library, let me know and I will add them.

**Currently working on the Greek Font and symbols.

TFT_Extension.zip (55.4 KB)

Apparently there was an issue with my ConnectFour game that I was unaware of. Here is the fixed version.
Sorry about that.

Added: I decided to make a Bluetooth chat sketch, with a decent looking keyboard and functionality, and so far the results are very promising. Right now it has all the lower case keys plus a working shift key which capitalizes the keys and stores them into a buffer array. I will add all the symbols [~!@#$%^&*()_+] too, but no F1 - F12 keys.

!!! The keyboard is done and working, and it is a new library function. : }

Connect_Four.ino (14.6 KB)

UPDATE

Keyboard functions and example sketch.

I tested the keyboard functions with RealTerm and works for portrait and landscape modes.
I may make it look better in appearance in the future, but that's for another time.

Enjoy.

ADDED: GreekFont. Drop inside UTFT folder
**If you look at the GreekFont's .c file and you see almost everything as ?, don't worry, it does the exact same thing on my end. For whatever reason, neither wordpad, notepad++, or MSword want to display the Greek symbols upon file entry. Sorry.

TFT_Extension.zip (58.4 KB)

GreekFont.c (3.3 KB)

Update for my Connect Four game!

Players can now play over Bluetooth, and the computer's diagonal block now works correctly. Also I made it so that the computer tries to win, thanks to the AISmartResponse function; The computer is now a rather good opponent.

The only thing I might add now, is a difficult setting and maybe some animations (show piece falling down into place instead of just appearing in place and have the pieces empty out of jig at the bottom).

Im thinking of new games to make, maybe Tetris :smiley:

I didn't realize, the game was not attached, my bad.

Connect_Four.ino (18.1 KB)

Slight update with Keyboard functions. New Font added!

Put new font into UTFT folder.

Game: Don't Block Me, is now able to be played in both landscape and portrait modes.
Just change this line #define Orientation LANDSCAPE to either LANDSCAPE or PORTRAIT, then upload to arduino.

Added:
Game: Connect_Four, now has falling animation and fixed "Host/Guest screen"

TFT_Extension.zip (58.7 KB)

TRONFont.c (6.65 KB)

Don_t_Block_Me_.ino (5.09 KB)

Connect_Four.ino (18.4 KB)

HazardsMind,
Thank you for all of your hard work! I tried your "Analog Gauge" example and a couple others but, I had problems compiling them. Here is the error message below for the Gauge example. Can you help fix it?

Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all

C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h: In member function 'void TFT_Extension::makeKeyboard()':
C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h:171: error: 'void UTFT::printChar(byte, int, int)' is protected
C:\Users\name\Documents\Arduino\libraries\TFT_Extension\TFT_Extension.cpp:1914: error: within this context
C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h: In member function 'void TFT_Extension::makeShiftKeys()':
C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h:171: error: 'void UTFT::printChar(byte, int, int)' is protected
C:\Users\name\Documents\Arduino\libraries\TFT_Extension\TFT_Extension.cpp:1935: error: within this context
C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h: In member function 'void TFT_Extension::makeCapsKeys()':
C:\Users\name\Documents\Arduino\libraries\UTFT/UTFT.h:171: error: 'void UTFT::printChar(byte, int, int)' is protected
C:\Users\name\Documents\Arduino\libraries\TFT_Extension\TFT_Extension.cpp:1950: error: within this context

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

I think you need to update your UTFT library. void printChar(byte c, int x, int y); should be under public: in the UTFT.h file but yours is saying it is under protected:

If you want, you can simply move the printChar function under the public access functions, save it, then it should work after that.

Thank you HazardsMind! I updated my UTFT library provided by Henning Karlson, and that fixed my problems with compiling your examples.

Something that my be helpful for other people using your examples would be this bit of commenting, and code that was provided with the UTFT library.

// Uncomment the next two lines for the Arduino 2009/UNO
//UTFT        myGLCD(ITDB24D,19,18,17,16);   // Remember to change the model parameter to suit your display module!
//UTouch      myTouch(15,10,14,9,8);

// Uncomment the next two lines for the Arduino Mega
UTFT        myGLCD(ITDB32S, 38,39,40,41);   // Remember to change the model parameter to suit your display module!
UTouch      myTouch(6,5,4,3,2);

Thank you for your work! It will really help me make some nice display screens!

I will include those. I also need to point out that some TFT LCD you buy online may appear to have the proper UTFT and Touch libraries, but in fact they are usually modified versions(fake) made for that particular TFT display. Mine just so happens to be one of those fake displays, so I am unable to use the real UTFT library, unless I buy a new display.

But never the less I found a way around that and made this library that works for both types of displays.

New game: Missile Bomber

Objective: destroy the incoming missiles and do NOT let them fall to the ground. Each missile is enough to wipe out an entire city, and if all 20 cities are destroyed, game over.

To destroy a missile, touch the center of them. 5 points for blowing up a missile, and 50 points triggers an additional missile. (6 max)

(Please keep in mind that an Arduino is not meant to display fast moving objects, so it will slow down.)

If anyone has a Due, let me know if it is any better. A small video would be helpful.

Missile_Bomber.ino (3.07 KB)

this is really help full for the draw gauge function thanks, is it possible to to draw more than one gauge?

I could make it so you could have more than one guage, let me modify the library.

if you wouldn't mind doing that that would be fantastic.

edit: also the HorSlider and VertSlider functions can they be used as a display? for instance analogRead(A0) map the values from 0-100 then use those as a display?

edit: also the HorSlider and VertSlider functions can they be used as a display? for instance analogRead(A0) map the values from 0-100 then use those as a display?

? What kind of display? They return 0-100 as a percent, so what else do you have in mind?

Updated library with new Gauges (10 Max)

Also all _Draw functions, (TouchButton_Draw, LatchCircle_Draw, TouchTriangle_Draw. . . etc) are now able to have centered text, they don't limit the text to the size of the "button", sorry too much code for that.
See the Latching_Buttons example.

Question for everyone else.
The library is kinda getting out of hand with all the structs, so if anyone has a better alternative, please share it. At first I was thinking of making everything into individual classes, but then everyone would need to drastically modify there sketches to use them. So if anyone has any ideas, please share and I will see what I can do.

TFT_Extension.zip (64.4 KB)

ok im pulling data from a megasquirt ecu via serial, i trying to make a display to show various information from the engine sensors connected to that, for instance using the slider like a bar graph to display throttle the throttle.

Oh ok, so the other way around, instead of being a slider, you want a bar graph. Yea I can do that.

Ah that would rock, just tried your update and its working good tried with 4 gauges on the screen, had them all reading from a 10k pot all working good thanks. i did try it before with just one gauge and it worked on pulling the data via serial and displaying it on the gauge as well

Library is updated with new functions, HorBarGraph and VertBarGraph. Go back to previous post and re-download.
Look at Horizontal_BarGraph example to see how it is used.

I also added your username to the .h file.

oh got it that rocks, with those additions gives me just what i need to continue with my project.