PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Display
libsimplegfx
setText.c
1
/*
2
* @file setText.c
3
*
4
* @author Matthew Matz
5
*
6
* @version 0.5
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2019. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief This is a driver that allows the Propeller Multicore Microcontroller to
12
* draw text, shapes, and bitmap files on various screens and displays.
13
*
14
* @detail This helper-library allows the Propeller Multicore Microcontroller to
15
* draw pixels, lines, circles, recatngles, rounded rectagles, triangles, formatted text
16
* in multiple fonts, bitmap images stored on an SD card on various screens and displays.
17
* At Parallax, we would like to thank Adafruit Industries as parts of this library
18
* were dervied from the Adafruit GFX library for Arduino. Please submit bug reports,
19
* suggestions, and improvements to this code to editor@parallax.com.
20
*
21
* @note If fonts are installed, they occupy EEPROM addresses 40576 to 63359.
22
*/
23
24
#include "simplegfx.h"
25
26
27
void
setCursor(
screen_t
*dev,
int
x
,
int
y,
char
size) {
28
if
(size < 1) {
29
dev->
cursor_x
=
x
;
30
dev->
cursor_y
= y;
31
}
else
{
32
dev->
cursor_x
=
x
* 6 * size;
33
dev->
cursor_y
= y * (size << 3);
34
}
35
}
36
37
void
setTextSize(
screen_t
*dev,
char
s) {
38
if
(dev->
font
[0] == 0)
39
{
40
dev->
text_size
= 1;
41
}
else
{
42
dev->
text_size
= s;
43
if
(s < 1) dev->
text_size
= 1;
44
if
(s > 3) dev->
text_size
= 3;
45
}
46
}
47
48
void
setTextColor(
screen_t
*dev,
int
c) {
49
dev->
text_color
= c;
50
}
51
52
void
setBgColor(
screen_t
*dev,
int
c) {
53
dev->
bg_color
= c;
54
}
55
56
void
setTextWrap(
screen_t
*dev,
char
w) {
57
dev->
text_wrap
= !(!w);
// Force it to be a boolean
58
}
59
screen_st::font
int font[5]
Definition:
simplegfx.h:128
screen_st::cursor_x
int cursor_x
Definition:
simplegfx.h:122
screen_st::bg_color
int bg_color
Definition:
simplegfx.h:143
screen_st::text_size
char text_size
Definition:
simplegfx.h:134
screen_st::text_color
int text_color
Definition:
simplegfx.h:140
x
int x
Definition:
07 Box and Lines.c:13
screen_st::cursor_y
int cursor_y
Definition:
simplegfx.h:125
screen_st::text_wrap
char text_wrap
Definition:
simplegfx.h:137
screen_st
Definition:
simplegfx.h:111
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17