2017-08-03 22:51:40 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the planetblupi source code
|
|
|
|
* Copyright (C) 1997, Daniel Roux & EPSITEC SA
|
|
|
|
* Copyright (C) 2017, Mathieu Schroeter
|
|
|
|
* http://epsitec.ch; http://www.blupi.org; http://github.com/blupi-games
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see http://gnu.org/licenses
|
|
|
|
*/
|
2017-01-21 17:27:46 +01:00
|
|
|
|
2017-01-21 23:44:30 +01:00
|
|
|
#pragma once
|
2017-01-21 17:27:46 +01:00
|
|
|
|
2017-02-09 18:28:00 +01:00
|
|
|
#include <unordered_map>
|
2017-02-04 17:59:07 +01:00
|
|
|
#include "def.h"
|
|
|
|
|
2017-03-01 18:10:20 +01:00
|
|
|
class CEvent;
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
class CMenu
|
|
|
|
{
|
|
|
|
public:
|
2017-02-12 13:14:22 +01:00
|
|
|
CMenu();
|
|
|
|
~CMenu();
|
|
|
|
|
2017-03-01 18:10:20 +01:00
|
|
|
bool Create (CPixmap *pPixmap, CSound *pSound, CEvent *pEvent,
|
2017-03-13 19:19:39 +01:00
|
|
|
POINT pos, Sint32 nb, Sint32 *pButtons, Errors *pErrors,
|
2017-02-12 13:14:22 +01:00
|
|
|
std::unordered_map<Sint32, const char *> &texts,
|
|
|
|
Sint32 perso);
|
2017-03-13 19:19:39 +01:00
|
|
|
void Update (Sint32 nb, Sint32 *pButtons, Errors *pErrors,
|
2017-02-12 13:14:22 +01:00
|
|
|
std::unordered_map<Sint32, const char *> &texts);
|
|
|
|
void Delete();
|
|
|
|
void Draw();
|
|
|
|
Sint32 GetSel();
|
|
|
|
Sint32 GetRank();
|
|
|
|
bool IsError();
|
|
|
|
bool IsExist();
|
|
|
|
void Message();
|
|
|
|
|
|
|
|
bool TreatEvent (const SDL_Event &event);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
protected:
|
2017-02-12 13:14:22 +01:00
|
|
|
Sint32 Detect (POINT pos);
|
|
|
|
bool MouseDown (POINT pos);
|
|
|
|
bool MouseMove (POINT pos);
|
|
|
|
bool MouseUp (POINT pos);
|
2017-01-21 17:27:46 +01:00
|
|
|
|
|
|
|
protected:
|
2017-02-12 13:14:22 +01:00
|
|
|
CPixmap *m_pPixmap;
|
|
|
|
CDecor *m_pDecor;
|
|
|
|
CSound *m_pSound;
|
2017-03-01 18:10:20 +01:00
|
|
|
CEvent *m_pEvent;
|
2017-02-12 13:14:22 +01:00
|
|
|
POINT m_pos; // coin sup/gauche
|
|
|
|
POINT m_dim; // dimensions
|
|
|
|
Sint32 m_nbButtons;
|
|
|
|
POINT m_nbCel;
|
|
|
|
Sint32 m_perso;
|
|
|
|
Sint32 m_buttons[MAXBUTTON];
|
2017-03-13 19:19:39 +01:00
|
|
|
Errors m_errors[MAXBUTTON];
|
2017-02-12 13:14:22 +01:00
|
|
|
std::unordered_map<Sint32, const char *> m_texts;
|
|
|
|
Uint32 m_messages[MAXBUTTON];
|
|
|
|
Sint32 m_selRank;
|
2017-01-21 17:27:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|