ZestCode
 
Loading...
Searching...
No Matches
screen.h
Go to the documentation of this file.
1
18
19#ifndef _PROS_SCREEN_H_
20#define _PROS_SCREEN_H_
21
22#include <stdarg.h>
23#include <stdbool.h>
24#define _GNU_SOURCE
25#include <stdio.h>
26#undef _GNU_SOURCE
27#include <stdint.h>
28
29#include "pros/colors.h" // c color macros
30
31#ifdef __cplusplus
32extern "C" {
33namespace pros {
34#endif
35
39
44
61
76
88
89#ifdef PROS_USE_SIMPLE_NAMES
90#ifdef __cplusplus
91#define TEXT_SMALL pros::E_TEXT_SMALL
92#define TEXT_MEDIUM pros::E_TEXT_MEDIUM
93#define TEXT_LARGE pros::E_TEXT_LARGE
94#define TEXT_MEDIUM_CENTER pros::E_TEXT_MEDIUM_CENTER
95#define TEXT_LARGE_CENTER pros::E_TEXT_LARGE_CENTER
96#define TOUCH_RELEASED pros::E_TOUCH_RELEASED
97#define TOUCH_PRESSED pros::E_TOUCH_PRESSED
98#define TOUCH_HELD pros::E_TOUCH_HELD
99#else
100#define TEXT_SMALL E_TEXT_SMALL
101#define TEXT_MEDIUM E_TEXT_MEDIUM
102#define TEXT_LARGE E_TEXT_LARGE
103#define TEXT_MEDIUM_CENTER E_TEXT_MEDIUM_CENTER
104#define TEXT_LARGE_CENTER E_TEXT_LARGE_CENTER
105#define TOUCH_RELEASED E_TOUCH_RELEASED
106#define TOUCH_PRESSED E_TOUCH_PRESSED
107#define TOUCH_HELD E_TOUCH_HELD
108#endif
109#endif
110
111typedef void (*touch_event_cb_fn_t)();
112
113#ifdef __cplusplus
114namespace c {
115#endif
116
120
149uint32_t screen_set_pen(uint32_t color);
150
178uint32_t screen_set_eraser(uint32_t color);
179
205uint32_t screen_get_pen(void);
206
232uint32_t screen_get_eraser(void);
233
258uint32_t screen_erase(void);
259
282uint32_t screen_scroll(int16_t start_line, int16_t lines);
283
313uint32_t screen_scroll_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t lines);
314
345uint32_t screen_copy_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32_t* buf, int32_t stride);
346
371uint32_t screen_draw_pixel(int16_t x, int16_t y);
372
400uint32_t screen_erase_pixel(int16_t x, int16_t y);
401
424uint32_t screen_draw_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
425
450uint32_t screen_erase_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
451
473uint32_t screen_draw_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
474
497uint32_t screen_erase_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
498
522uint32_t screen_fill_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
523
546uint32_t screen_draw_circle(int16_t x, int16_t y, int16_t radius);
547
572uint32_t screen_erase_circle(int16_t x, int16_t y, int16_t radius);
573
599uint32_t screen_fill_circle(int16_t x, int16_t y, int16_t radius);
600
602
606
633uint32_t screen_print(text_format_e_t txt_fmt, const int16_t line, const char* text, ...);
634
665uint32_t screen_print_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char* text, ...);
666
689uint32_t screen_vprintf(text_format_e_t txt_fmt, const int16_t line, const char* text, va_list args);
690
715uint32_t screen_vprintf_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char* text, va_list args);
716
718
722
751
779uint32_t screen_touch_callback(touch_event_cb_fn_t cb, last_touch_e_t event_type);
780
782
784
785#ifdef __cplusplus
786} // namespace c
787} // namespace pros
788}
789#endif
790
791#endif
uint32_t screen_erase_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
uint32_t screen_erase(void)
text_format_e_t
Definition screen.h:49
uint32_t screen_vprintf_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char *text, va_list args)
uint32_t screen_erase_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
uint32_t screen_scroll(int16_t start_line, int16_t lines)
uint32_t screen_draw_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
uint32_t screen_touch_callback(touch_event_cb_fn_t cb, last_touch_e_t event_type)
uint32_t screen_erase_pixel(int16_t x, int16_t y)
screen_touch_status_s_t screen_touch_status(void)
uint32_t screen_scroll_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t lines)
uint32_t screen_set_pen(uint32_t color)
uint32_t screen_copy_area(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint32_t *buf, int32_t stride)
uint32_t screen_draw_circle(int16_t x, int16_t y, int16_t radius)
uint32_t screen_get_pen(void)
uint32_t screen_print_at(text_format_e_t txt_fmt, const int16_t x, const int16_t y, const char *text,...)
uint32_t screen_draw_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
uint32_t screen_fill_rect(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
last_touch_e_t
Definition screen.h:66
uint32_t screen_print(text_format_e_t txt_fmt, const int16_t line, const char *text,...)
uint32_t screen_vprintf(text_format_e_t txt_fmt, const int16_t line, const char *text, va_list args)
uint32_t screen_set_eraser(uint32_t color)
uint32_t screen_erase_circle(int16_t x, int16_t y, int16_t radius)
uint32_t screen_fill_circle(int16_t x, int16_t y, int16_t radius)
uint32_t screen_draw_pixel(int16_t x, int16_t y)
uint32_t screen_get_eraser(void)
@ E_TEXT_SMALL
Small text font size.
Definition screen.h:51
@ E_TEXT_LARGE_CENTER
Large centered text.
Definition screen.h:59
@ E_TEXT_MEDIUM_CENTER
Medium centered text.
Definition screen.h:57
@ E_TEXT_LARGE
Large text font size.
Definition screen.h:55
@ E_TEXT_MEDIUM
Normal/Medium text font size.
Definition screen.h:53
@ E_TOUCH_ERROR
An error occured while taking/returning the mutex.
Definition screen.h:74
@ E_TOUCH_PRESSED
Last interaction with screen was a release.
Definition screen.h:70
@ E_TOUCH_HELD
User is holding screen down.
Definition screen.h:72
@ E_TOUCH_RELEASED
Last interaction with screen was a quick press.
Definition screen.h:68
Definition screen.h:81
last_touch_e_t touch_status
Represents if the screen is being held, released, or pressed.
Definition screen.h:82
int32_t press_count
Represents how many times the screen has be pressed.
Definition screen.h:85
int16_t x
Represents the x value of the location of the touch.
Definition screen.h:83
int16_t y
Represents the y value of the location of the touch.
Definition screen.h:84
int32_t release_count
Represents how many times the user released after a touch on the screen.
Definition screen.h:86