Skip to content

Commit

Permalink
print simply text as a welocome screen
Browse files Browse the repository at this point in the history
  • Loading branch information
petrkucerak committed Apr 28, 2021
1 parent b4e31b7 commit baf7220
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"files.associations": {
"draw_shapes.h": "c",
"data_structures.h": "c",
"map_template.h": "c"
"map_template.h": "c",
"text_fb.h": "c",
"font_types.h": "c",
"menu_utilities.h": "c"
}
}
9 changes: 7 additions & 2 deletions apoman.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ int main(int argc, char *argv[])
// init display
parlcd_hx8357_init(lcd_mem_base);
font_descriptor_t *font = &font_winFreeSystem14x16;
map_data *map = create_map_data(SCREEN_WIDTH, SCREEN_HEIGHT, &map_circles);

run_init_game_menu();
// text menu
run_init_game_menu(&fb, lcd_mem_base, font);

// exit for debug
exit(-1);

map_data *map = create_map_data(SCREEN_WIDTH, SCREEN_HEIGHT, &map_circles);

// get starting coords for pacman
coords pacman = get_coords_from_template(map_circles.pacman_spawn_y,
Expand Down
26 changes: 23 additions & 3 deletions menu_utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,32 @@
*******************************************************************/

#include "menu_utilities.h"
#include <stdio.h>
#include "menu_utilities.h"
#include "data_structures.h"
#include "draw_shapes.h"
#include "update_peripherals.h"
#include "text_fb.h"

void run_init_game_menu()
bool run_init_game_menu(fb_data *frame_buff, unsigned char *lcd_mem_base, font_descriptor_t *font)
{
printf("run init game menu\n");

set_background( , 0);
welcome_screen(frame_buff);
lcd_from_fb(frame_buff, lcd_mem_base);
printf("background set\n");

char text[] = "HLAVNI MENU";
draw_text_center(frame_buff, text, 0, 0, 10, font, 0x1f);

return true;

}

void welcome_screen(fb_data *frame_buff)
{
set_background(frame_buff, 0);
for(int i=0; i<frame_buff->width*frame_buff->height; ++i){
if(i%30<15) frame_buff->fb[i] = 0x1f;
}
}
7 changes: 6 additions & 1 deletion menu_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
license: any combination of GPL, LGPL, MPL or BSD licenses
*******************************************************************/
#include <stdbool.h>
#include "data_structures.h"
#include "font_types.h"

#ifndef MENU_UTILITIES_H
#define MENU_UTILITIES_H

void run_init_game_menu();
bool run_init_game_menu(fb_data *frame_buff, unsigned char *lcd_mem_base, font_descriptor_t *font);

void welcome_screen(fb_data *frame_buff);

#endif

0 comments on commit baf7220

Please sign in to comment.