mirror of
https://github.com/stasenso/rp_pico_display_engine.git
synced 2026-06-26 21:32:41 +03:00
Refactor font module layout and integration
This commit is contained in:
+11
-1
@@ -7,7 +7,17 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
|
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} main.c Thread.c font_data.c BackBuffer.c)
|
add_executable(${PROJECT_NAME}
|
||||||
|
main.c
|
||||||
|
Thread.c
|
||||||
|
src/Font/font_data.c
|
||||||
|
src/render/context.c
|
||||||
|
BackBuffer.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include "display/render/context.h"
|
||||||
extern const uint16_t font_width;
|
extern const uint16_t font_width;
|
||||||
extern const uint16_t font_height;
|
extern const uint16_t font_height;
|
||||||
extern const uint8_t font_data[];
|
extern const uint8_t font_data[];
|
||||||
|
|
||||||
void draw_string(uint16_t x, uint16_t y, const wchar_t *str, uint16_t Color);
|
void draw_string(render_ctx_t* ctx, uint16_t x, uint16_t y, const wchar_t *str, uint16_t Color);
|
||||||
void draw_char(uint16_t x, uint16_t y,uint8_t wdh, wchar_t c, uint16_t color);
|
void draw_char(render_ctx_t* ctx, uint16_t x, uint16_t y, uint8_t wdh, wchar_t c, uint16_t color);
|
||||||
uint8_t get_char_width(wchar_t c);
|
uint8_t get_char_width(wchar_t c);
|
||||||
#endif // FONT_DATA_H
|
#endif // FONT_DATA_H
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "pico/multicore.h"
|
#include "pico/multicore.h"
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "font_data.h"
|
#include "Font/font_data.h"
|
||||||
|
#include "display/render/context.h"
|
||||||
#include "BackBuffer.h"
|
#include "BackBuffer.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
@@ -29,6 +30,7 @@ int main() {
|
|||||||
float x=0.0;
|
float x=0.0;
|
||||||
float freq=1.0;
|
float freq=1.0;
|
||||||
bool minmax=false;
|
bool minmax=false;
|
||||||
|
render_ctx_t rc;
|
||||||
wchar_t buffer[100];
|
wchar_t buffer[100];
|
||||||
while (x<500)
|
while (x<500)
|
||||||
{
|
{
|
||||||
@@ -37,8 +39,9 @@ int main() {
|
|||||||
fillBufer(frame_buffer,reverse(0x4A69));//
|
fillBufer(frame_buffer,reverse(0x4A69));//
|
||||||
grid(20,20,40,0x634d);
|
grid(20,20,40,0x634d);
|
||||||
generate_sine_wave_points(num_points, 50, freq, 0, HEIGHT / 2,x);
|
generate_sine_wave_points(num_points, 50, freq, 0, HEIGHT / 2,x);
|
||||||
|
render_begin(&rc, frame_buffer, WIDTH, HEIGHT);
|
||||||
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), L"Value of pi: %.2f", temperature);
|
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), L"Value of pi: %.2f", temperature);
|
||||||
draw_string(20,110,buffer,0b1111111111111111); //
|
draw_string(&rc, 20,110,buffer,0b1111111111111111); //
|
||||||
multicore_fifo_push_blocking(0); //Экран 0 нарисован
|
multicore_fifo_push_blocking(0); //Экран 0 нарисован
|
||||||
x+=0.03;
|
x+=0.03;
|
||||||
if (minmax)
|
if (minmax)
|
||||||
@@ -74,4 +77,3 @@ void fillBufer (uint16_t* buffer,uint16_t color){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user