2 * This file is free software: you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
7 * This file is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 * See the GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License along
13 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <AP_OSD/AP_OSD_Backend.h>
22 #ifdef HAVE_SFML_GRAPHICS_H
23 #include <SFML/Graphics.h>
25 #include <SFML/Graphics.hpp>
28 class AP_OSD_SITL
: public AP_OSD_Backend
32 static AP_OSD_Backend
*probe(AP_OSD
&osd
);
34 //draw given text to framebuffer
35 void write(uint8_t x
, uint8_t y
, const char* text
) override
;
37 //initialize display port and underlying hardware
40 //flush framebuffer to screen
41 void flush() override
;
44 void clear() override
;
46 bool is_compatible_with_backend_type(AP_OSD::osd_types type
) const override
{
48 case AP_OSD::osd_types::OSD_MAX7456
:
49 case AP_OSD::osd_types::OSD_SITL
:
51 case AP_OSD::osd_types::OSD_NONE
:
52 case AP_OSD::osd_types::OSD_TXONLY
:
53 case AP_OSD::osd_types::OSD_MSP
:
54 case AP_OSD::osd_types::OSD_MSP_DISPLAYPORT
:
60 AP_OSD::osd_types
get_backend_type() const override
{
61 return AP_OSD::osd_types::OSD_SITL
;
65 AP_OSD_SITL(AP_OSD
&osd
);
69 sf::Texture font
[256];
72 // setup to match MAX7456 layout
73 static const uint8_t char_width
= 12;
74 static const uint8_t char_height
= 18;
77 static const uint8_t char_spacing
= 0;
79 // scaling factor to make it easier to read
80 static const uint8_t char_scale
= 2;
82 // get a byte from a buffer
83 uint8_t &getbuffer(uint8_t *buf
, uint8_t y
, uint8_t x
) const {
84 return buf
[y
*uint32_t(video_cols
) + x
];
90 static void *update_thread_start(void *obj
);
96 uint32_t last_counter
;
99 #endif // WITH_SITL_OSD