more damning ui features
This commit is contained in:
@@ -14,12 +14,12 @@ MenuItem* create_menu(size_t item_count)
|
||||
return items;
|
||||
}
|
||||
|
||||
void set_menu_item(MenuItem* menu, int index, const char* text)
|
||||
void set_menu_item(MenuItem* menu, int id, const char* text)
|
||||
{
|
||||
int id = index + 1;
|
||||
int index = id - 1;
|
||||
if (menu && text)
|
||||
{
|
||||
menu[index].text = (char*)malloc(strlen(text) + 1);
|
||||
menu[index].text = malloc(strlen(text) + 1);
|
||||
if (menu[index].text)
|
||||
{
|
||||
strcpy(menu[index].text, text);
|
||||
|
6
program/include/store.h
Normal file
6
program/include/store.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef STORE_H
|
||||
#define STORE_H
|
||||
|
||||
void render_store_menu();
|
||||
|
||||
#endif // !STORE_H
|
@@ -3,14 +3,15 @@
|
||||
#include "../../libpukeko/include/navigation.h"
|
||||
|
||||
void print_debug_menu() {
|
||||
int items_count = 2;
|
||||
int items_count = 3;
|
||||
|
||||
MenuItem* menu = create_menu(items_count);
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
set_menu_item(menu, 0, "Add money (500)");
|
||||
set_menu_item(menu, 1, "Back");
|
||||
set_menu_item(menu, 1, "Add money (500)");
|
||||
set_menu_item(menu, 2, "Add money (100000)");
|
||||
set_menu_item(menu, 3, "Back");
|
||||
|
||||
while (true) {
|
||||
int selection = selector_render(menu, items_count);
|
||||
@@ -18,10 +19,13 @@ void print_debug_menu() {
|
||||
switch (selection)
|
||||
{
|
||||
case 1:
|
||||
user_money = user_money + 500;
|
||||
user_money += 500;
|
||||
break;
|
||||
case 2:
|
||||
user_money += 100000;
|
||||
break;
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
destroy_menu(menu, items_count);
|
||||
return;
|
||||
}
|
||||
|
@@ -2,19 +2,21 @@
|
||||
#include "main_menu.h"
|
||||
#include "pukeko_app.h"
|
||||
#include "pukeko.h"
|
||||
#include "store.h"
|
||||
#include "debug.h"
|
||||
#include "../../libpukeko/include/navigation.h"
|
||||
|
||||
void print_main_menu() {
|
||||
int items_count = 3;
|
||||
int items_count = 4;
|
||||
|
||||
MenuItem* menu = create_menu(items_count);
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
set_menu_item(menu, 0, "Catch pukekos");
|
||||
set_menu_item(menu, 1, "Debugging");
|
||||
set_menu_item(menu, 2, "Quit");
|
||||
set_menu_item(menu, 1, "Catch pukekos");
|
||||
set_menu_item(menu, 2, "Debugging");
|
||||
set_menu_item(menu, 3, "Shop");
|
||||
set_menu_item(menu, 4, "Quit");
|
||||
|
||||
while (true) {
|
||||
int selection = selector_render(menu, items_count);
|
||||
@@ -23,13 +25,17 @@ void print_main_menu() {
|
||||
case 1:
|
||||
consoleClear();
|
||||
print_game_screen();
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
print_debug_menu();
|
||||
break;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
render_store_menu();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
destroy_menu(menu, items_count);
|
||||
return;
|
||||
}
|
||||
|
@@ -5,44 +5,99 @@
|
||||
#include "pukeko_app.h"
|
||||
#include "pukeko.h"
|
||||
|
||||
void print_top_info() {
|
||||
// RO data
|
||||
|
||||
char* damning_messages[] = {
|
||||
"DAMN!!! ",
|
||||
"DAMN, what was that?! ",
|
||||
"DAMN, its so fluffy! ",
|
||||
"DAMN!!! This birds got moves! ",
|
||||
"DAMN, did you see that?!! ",
|
||||
"DAMN, its a disaster! ",
|
||||
"DAMN, I cant stop laughing! ",
|
||||
"DAMN, I just caught it! ",
|
||||
"DAMN, the birds on fire!! ",
|
||||
"DAMN, this is too much! "
|
||||
};
|
||||
|
||||
// Logic functions
|
||||
|
||||
void print_pukeko_ascii()
|
||||
{
|
||||
printf("\x1b[4;5H _____");
|
||||
printf("\x1b[5;5H ___/ o \\");
|
||||
printf("\x1b[6;5H < > )");
|
||||
printf("\x1b[7;5H \\_________/");
|
||||
printf("\x1b[8;8H || ||");
|
||||
printf("\x1b[9;7H || ||");
|
||||
printf("\x1b[10;6H ^^ ^^");
|
||||
}
|
||||
|
||||
void catch_pukeko()
|
||||
{
|
||||
int random_number = rand() % 5 + 1;
|
||||
int random_message = rand() % 10;
|
||||
printf("\x1b[1;1H%s", damning_messages[random_message]);
|
||||
held_pukekos = held_pukekos + random_number;
|
||||
sleep(2);
|
||||
printf("\x1b[1;1H(A) Catch Pukeko!!!");
|
||||
}
|
||||
|
||||
void sell_pukeko()
|
||||
{
|
||||
user_money += held_pukekos * 5;
|
||||
held_pukekos = 0;
|
||||
}
|
||||
|
||||
// Print functions
|
||||
|
||||
void print_top_info()
|
||||
{
|
||||
printf("\x1b[1;1H(A) Catch Pukeko!!!");
|
||||
printf("\x1b[2;1H(Y) Sell Pukeko... :(");
|
||||
printf("\x1b[30;1H(B) Go back");
|
||||
}
|
||||
|
||||
void print_bottom_info() {
|
||||
void print_bottom_info()
|
||||
{
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
printf("\x1b[1;1HMoney: %d", user_money);
|
||||
|
||||
printf("\x1b[3;1HPukekos: %d", held_pukekos);
|
||||
print_pukeko_ascii();
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
}
|
||||
|
||||
void catch_pukeko() {
|
||||
int random_number = rand() % 5 + 1;
|
||||
|
||||
printf("\x1b[1;1HDAMN!!! ");
|
||||
held_pukekos = held_pukekos + random_number;
|
||||
sleep(2);
|
||||
print_bottom_info();
|
||||
print_top_info();
|
||||
printf("\x1b[1;1H(A) Catch Pukeko!!!");
|
||||
}
|
||||
|
||||
void print_game_screen() {
|
||||
void print_game_screen()
|
||||
{
|
||||
// Show screen
|
||||
print_bottom_info();
|
||||
print_top_info();
|
||||
|
||||
while (true) {
|
||||
while (true)
|
||||
{
|
||||
hidScanInput();
|
||||
u32 key_down = hidKeysDown();
|
||||
|
||||
if (key_down & KEY_A) {
|
||||
catch_pukeko();
|
||||
}
|
||||
if (key_down & KEY_B) {
|
||||
return;
|
||||
if (key_down)
|
||||
{
|
||||
if (key_down & KEY_A)
|
||||
catch_pukeko();
|
||||
|
||||
if (key_down & KEY_Y)
|
||||
sell_pukeko();
|
||||
|
||||
if (key_down & KEY_B)
|
||||
{
|
||||
consoleInit(GFX_BOTTOM, NULL);
|
||||
consoleClear();
|
||||
consoleInit(GFX_TOP, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update display
|
||||
print_bottom_info();
|
||||
print_top_info();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
27
program/src/store/damn_level.c
Normal file
27
program/src/store/damn_level.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <3ds.h>
|
||||
#include "store.h"
|
||||
#include "../../../libpukeko/include/navigation.h"
|
||||
|
||||
void render_store_menu()
|
||||
{
|
||||
size_t item_count = 2;
|
||||
MenuItem* store_menu = create_menu(item_count);
|
||||
|
||||
set_menu_item(store_menu, 1, "DAMN!!! level");
|
||||
set_menu_item(store_menu, 2, "Back");
|
||||
|
||||
while (true)
|
||||
{
|
||||
int selection = selector_render(store_menu, item_count);
|
||||
switch (selection)
|
||||
{
|
||||
case 1:
|
||||
//draw_damn_level_menu();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
destroy_menu(store_menu, item_count);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
BIN
pukeko-3ds.3dsx
BIN
pukeko-3ds.3dsx
Binary file not shown.
Reference in New Issue
Block a user