[Add] Began adding first stages of options menu.

[Change] Updated TODO.
[Change] Made --help options a little more explicit.
[Remove] Removed warning about differing Lephisto data between versions.
This commit is contained in:
Allanis 2014-03-10 00:42:46 +00:00
parent 1d811a613f
commit 91f851870c
7 changed files with 76 additions and 9 deletions

3
TODO
View File

@ -49,7 +49,8 @@ Minor:
-- Objects always in sight (depending on resolution).
-- Allow creating collision masks to make collision more realistic.
-- Improve font system to handle unicode.
-- Possibly use Queso CGL
-- Mission improvements.
-- Allow creation of OSD (On Screen Displays).
SOMEDAY!! MAYBE...:
-- 3d models (not actually a 3D perspective, just no sprites).

View File

@ -63,10 +63,10 @@ static void print_usage(char** argv);
/* Print usage. */
static void print_usage(char** argv) {
LOG("USAGE: %s [OPTION]", argv[0]);
LOG("USAGE: %s [OPTIONS]", argv[0]);
LOG("Options are:");
LOG(" -f, --fullscreen - Fullscreen");
LOG(" -F, --fps - Limit frames per second");
LOG(" -f, --fullscreen - Activate fullscreen");
LOG(" -F, --fps - Limit frames per second to n");
LOG(" -V, --vsync - Enable vsync");
LOG(" -d s, --data s - Set the data file to be s");
LOG(" -W n - Set width to n");

View File

@ -603,8 +603,10 @@ static void data_name(void) {
buf = pack_readfile(DATA, VERSION_FILE, &bufsize);
if(strncmp(buf, version, bufsize) != 0) {
WARN("Lephisto version and data module version differ!");
WARN("Lephisto is v%s, data is for v%s", version, buf);
/* 0.3.4 release will use 0.3.3 ldata, we don't to warn.
DEBUG("Lephisto version and data module version differ!");
DEBUG("Lephisto is v%s, data is for v%s", version, buf);
*/
}
free(buf);

View File

@ -43,6 +43,8 @@
#define DEATH_WIDTH 130 /**< Death menu width. */
#define DEATH_HEIGHT 150 /**< Death menu height. */
#define OPTIONS_WIDTH 130 /**< Options menu width. */
#define OPTIONS_HEIGHT 150 /**< Options menu height. */
#define BUTTON_WIDTH 90 /**< Button width, standard across menus. */
#define BUTTON_HEIGHT 30 /**< Button height, standard across menus. */
@ -75,6 +77,8 @@ static void mission_menu_genList(unsigned int wid, int first);
static void mission_menu_update(unsigned int wid, char* str);
/* Death menu. */
static void menu_death_main(unsigned int parent, char* str);
/* Options menu. */
static void menu_options_close(unsigned int parent, char* str);
/**
* @fn void menu_main(void)
@ -108,7 +112,7 @@ void menu_main(void) {
"btnNew", "New Game", menu_main_new);
window_addButton(wid, 20, 20 + (BUTTON_HEIGHT+20),
BUTTON_WIDTH, BUTTON_HEIGHT,
"btnOptions", "Options", NULL);
"btnOptions", "Options", (void(*)(unsigned int,char*))menu_options);
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnExit", "Exit", menu_main_exit);
@ -205,7 +209,7 @@ void menu_small(void) {
window_addButton(wid, 20, 20 + BUTTON_HEIGHT + 20,
BUTTON_WIDTH, BUTTON_HEIGHT,
"btnOptions", "Options", NULL);
"btnOptions", "Options", (void(*)(unsigned int,char*))menu_options);
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnExit", "Exit", menu_small_exit);
@ -278,7 +282,7 @@ void menu_info(void) {
unsigned int wid;
/* Can't open menu twise. */
if(menu_isOpen(MENU_INFO)) return;
if(menu_isOpen(MENU_INFO) || dialogue_isOpen()) return;
wid = window_create("Info", -1, -1, INFO_WIDTH, INFO_HEIGHT);
@ -612,3 +616,32 @@ static void menu_death_main(unsigned int parent, char* str) {
menu_main();
}
/**
* @brief Opens the options menu.
*/
void menu_options(void) {
unsigned int wid;
wid = window_create("Options", -1, -1, OPTIONS_WIDTH, OPTIONS_HEIGHT);
window_addButton(wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
"btnClose", "Close", menu_options_close);
window_addButton(wid, 20, 20+(BUTTON_HEIGHT+20),
BUTTON_WIDTH, BUTTON_HEIGHT,
"btnKeybinds", "Keybindings", NULL);
menu_Open(MENU_OPTIONS);
}
/**
* @brief Closes the options menu.
* @param str Unused.
*/
static void menu_options_close(unsigned int parent, char* str) {
(void)parent;
(void)str;
unsigned int wid;
wid = window_get("Options");
window_destroy(wid);
menu_Close(MENU_OPTIONS);
}

View File

@ -4,6 +4,7 @@
#define MENU_SMALL (1<<1) /**< Small ingame menu. */
#define MENU_INFO (1<<2) /**< Player information menu. */
#define MENU_DEATH (1<<3) /**< Player death menu. */
#define MENU_OPTIONS (1<<4) /**< Player's options menu. */
#define menu_isOpen(f) (menu_open & (f)) /**< Check if a certain menu is opened. */
extern int menu_open;
@ -12,4 +13,5 @@ void menu_main(void);
void menu_small(void);
void menu_info(void);
void menu_death(void);
void menu_options(void);

25
src/options.c Normal file
View File

@ -0,0 +1,25 @@
/**
* @file menu.h
*
* @brief Handle the important game menus.
*/
#include <string.h>
#include <SDL/SDL.h>
#include "log.h"
#include "lephisto.h"
#include "input.h"
#include "toolkit.h"
#include "options.h"
#define KEYBIND_WIDTH 130 /**< Options menu width. */
#define KEYBIND_HEIGHT 150 /**< Options menu height. */
#define BUTTON_WIDTH 90 /**< Button width, standard across menus. */
#define BUTTON_HEIGHT 30 /**< Button height, standard across menus. */
void opt_menuKeybinds(void) {
}

4
src/options.h Normal file
View File

@ -0,0 +1,4 @@
#pragma once
void opt_menuKeybinds(void);