94 lines
3.5 KiB
C++
94 lines
3.5 KiB
C++
#include "m_menu.h"
|
|
#include "jgame.h"
|
|
#include "jinput.h"
|
|
#include "jdraw.h"
|
|
#include "config.h"
|
|
#include <SDL2/SDL.h>
|
|
#include "jaudio.h"
|
|
namespace modules
|
|
{
|
|
namespace menu
|
|
{
|
|
draw::surface *surf;
|
|
int anim_pos=0;
|
|
int retras=4;
|
|
|
|
int selected_option = OPTION_JUGAR;
|
|
|
|
void init()
|
|
{
|
|
if (config::isMusicEnabled())
|
|
{
|
|
audio::stopMusic();
|
|
}
|
|
selected_option = OPTION_JUGAR;
|
|
::game::setUpdateTicks(64);
|
|
draw::loadPalette("test.gif");
|
|
surf = draw::getSurface("test.gif");
|
|
draw::restorecol(2);
|
|
}
|
|
|
|
int loop()
|
|
{
|
|
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) {
|
|
return OPTION_EIXIR;
|
|
}
|
|
if (input::keyPressed(SDL_SCANCODE_DOWN) || input::keyPressed(config::getKey(KEY_DOWN)))
|
|
selected_option = (selected_option+1)&3;
|
|
|
|
if (input::keyPressed(SDL_SCANCODE_UP) || input::keyPressed(config::getKey(KEY_UP)))
|
|
selected_option = (selected_option-1)&3;
|
|
|
|
if (input::keyPressed(SDL_SCANCODE_SPACE) || input::keyPressed(SDL_SCANCODE_RETURN) ||
|
|
input::keyPressed(config::getKey(KEY_JUMP)) || input::keyPressed(config::getKey(KEY_PICK))) {
|
|
return selected_option;
|
|
}
|
|
|
|
draw::cls(2);
|
|
draw::color(1);
|
|
|
|
draw::swapcol(1, WHITE);
|
|
draw::setSource(surf);
|
|
draw::draw(150,56,20,32,64+anim_pos*20,32);
|
|
retras--;
|
|
if (retras==0) {retras=4; anim_pos=(anim_pos+1)&1; }
|
|
|
|
draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL);
|
|
|
|
switch (selected_option)
|
|
{
|
|
case OPTION_JUGAR:
|
|
draw::print2("fg JUGAR AL JOC", 11, 14, YELLOW, FONT_ZOOM_VERTICAL);
|
|
draw::print2("de REDEFINIR TECLES", 11, 17, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de CONFIGURAR AUDIO", 11, 19, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de EIXIR", 11, 21, GREEN, FONT_ZOOM_NONE);
|
|
break;
|
|
case OPTION_TECLES:
|
|
draw::print2("de JUGAR AL JOC", 11, 14, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("fg REDEFINIR TECLES", 11, 16, YELLOW, FONT_ZOOM_VERTICAL);
|
|
draw::print2("de CONFIGURAR AUDIO", 11, 19, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de EIXIR", 11, 21, GREEN, FONT_ZOOM_NONE);
|
|
break;
|
|
case OPTION_AUDIO:
|
|
draw::print2("de JUGAR AL JOC", 11, 14, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de REDEFINIR TECLES", 11, 16, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("fg CONFIGURAR AUDIO", 11, 18, YELLOW, FONT_ZOOM_VERTICAL);
|
|
draw::print2("de EIXIR", 11, 21, GREEN, FONT_ZOOM_NONE);
|
|
break;
|
|
case OPTION_EIXIR:
|
|
draw::print2("de JUGAR AL JOC", 11, 14, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de REDEFINIR TECLES", 11, 16, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("de CONFIGURAR AUDIO", 11, 18, GREEN, FONT_ZOOM_NONE);
|
|
draw::print2("fg EIXIR", 11, 20, YELLOW, FONT_ZOOM_VERTICAL);
|
|
break;
|
|
|
|
};
|
|
|
|
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);
|
|
|
|
draw::render();
|
|
return OPTION_NONE;
|
|
}
|
|
}
|
|
}
|