2008-06-24 03:17:31 -07:00
|
|
|
#ifndef _SECTORVIEW_H
|
|
|
|
#define _SECTORVIEW_H
|
|
|
|
|
|
|
|
#include "libs.h"
|
2011-05-21 07:37:01 -07:00
|
|
|
#include "gui/Gui.h"
|
2008-06-24 03:17:31 -07:00
|
|
|
#include "View.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2011-02-10 18:03:27 -08:00
|
|
|
#include "View.h"
|
2011-06-20 03:25:49 -07:00
|
|
|
#include "Sector.h"
|
2011-06-27 04:46:28 -07:00
|
|
|
#include "SystemPath.h"
|
2008-06-24 03:17:31 -07:00
|
|
|
|
2011-02-10 18:03:27 -08:00
|
|
|
class SectorView: public View {
|
2008-06-24 03:17:31 -07:00
|
|
|
public:
|
|
|
|
SectorView();
|
|
|
|
virtual ~SectorView();
|
|
|
|
virtual void Update();
|
|
|
|
virtual void Draw3D();
|
2011-08-09 15:42:07 -07:00
|
|
|
vector3f GetPosition() const { return m_pos; }
|
2011-06-27 17:33:37 -07:00
|
|
|
SystemPath GetSelectedSystem() const { return m_selected; }
|
2011-06-27 23:49:59 -07:00
|
|
|
SystemPath GetHyperspaceTarget() const { return m_hyperspaceTarget; }
|
|
|
|
void SetHyperspaceTarget(const SystemPath &path);
|
2011-07-03 15:24:16 -07:00
|
|
|
void FloatHyperspaceTarget();
|
|
|
|
void ResetHyperspaceTarget();
|
2011-06-27 17:33:37 -07:00
|
|
|
void GotoSystem(const SystemPath &path);
|
2011-08-10 04:07:08 -07:00
|
|
|
void GotoCurrentSystem() { GotoSystem(m_current); }
|
|
|
|
void GotoSelectedSystem() { GotoSystem(m_selected); }
|
|
|
|
void GotoHyperspaceTarget() { GotoSystem(m_hyperspaceTarget); }
|
2011-06-27 17:33:37 -07:00
|
|
|
void WarpToSystem(const SystemPath &path);
|
2010-05-22 10:26:25 -07:00
|
|
|
virtual void Save(Serializer::Writer &wr);
|
|
|
|
virtual void Load(Serializer::Reader &rd);
|
2011-02-01 21:24:56 -08:00
|
|
|
virtual void OnSwitchTo();
|
2011-06-28 15:12:06 -07:00
|
|
|
|
|
|
|
sigc::signal<void> onHyperspaceTargetChanged;
|
2011-08-10 03:20:32 -07:00
|
|
|
|
2008-06-24 03:17:31 -07:00
|
|
|
private:
|
2011-08-10 03:20:32 -07:00
|
|
|
struct SystemLabels {
|
|
|
|
Gui::Label *systemName;
|
|
|
|
Gui::Label *distance;
|
|
|
|
Gui::Label *starType;
|
|
|
|
Gui::Label *shortDesc;
|
|
|
|
};
|
|
|
|
|
2011-07-22 10:36:44 -07:00
|
|
|
void DrawSector(int x, int y, int z, const vector3f &playerAbsPos);
|
|
|
|
void PutClickableLabel(const std::string &text, const Color &labelCol, const SystemPath &path);
|
2011-08-12 00:10:58 -07:00
|
|
|
|
|
|
|
void SetSelectedSystem(const SystemPath &path);
|
2011-06-27 17:33:37 -07:00
|
|
|
void OnClickSystem(const SystemPath &path);
|
2011-07-03 23:18:18 -07:00
|
|
|
|
2011-08-10 03:20:32 -07:00
|
|
|
void UpdateSystemLabels(SystemLabels &labels, const SystemPath &path);
|
|
|
|
|
2010-03-13 10:33:15 -08:00
|
|
|
void MouseButtonDown(int button, int x, int y);
|
2011-07-18 06:27:00 -07:00
|
|
|
Sector* GetCached(int sectorX, int sectorY, int sectorZ);
|
2011-07-03 23:18:18 -07:00
|
|
|
void OnKeyPress(SDL_keysym *keysym);
|
2011-07-22 10:36:44 -07:00
|
|
|
void OnSearchBoxValueChanged();
|
2011-06-20 03:25:49 -07:00
|
|
|
void ShrinkCache();
|
2008-06-24 03:17:31 -07:00
|
|
|
|
|
|
|
float m_zoom;
|
2011-06-27 17:33:37 -07:00
|
|
|
|
|
|
|
bool m_firstTime;
|
2011-08-10 04:07:08 -07:00
|
|
|
|
|
|
|
SystemPath m_current;
|
2011-06-27 17:33:37 -07:00
|
|
|
SystemPath m_selected;
|
|
|
|
|
2011-07-18 06:27:00 -07:00
|
|
|
vector3f m_pos;
|
|
|
|
vector3f m_posMovingTo;
|
2011-08-07 23:43:54 -07:00
|
|
|
|
|
|
|
float m_rotX, m_rotZ;
|
|
|
|
float m_rotXMovingTo, m_rotZMovingTo;
|
|
|
|
|
2011-06-27 23:49:59 -07:00
|
|
|
SystemPath m_hyperspaceTarget;
|
|
|
|
bool m_matchTargetToSelection;
|
|
|
|
|
2011-08-12 00:10:58 -07:00
|
|
|
bool m_selectionFollowsMovement;
|
|
|
|
|
2011-08-09 16:06:49 -07:00
|
|
|
Gui::Label *m_sectorLabel;
|
|
|
|
Gui::Label *m_distanceLabel;
|
2008-06-24 03:17:31 -07:00
|
|
|
Gui::ImageButton *m_zoomInButton;
|
|
|
|
Gui::ImageButton *m_zoomOutButton;
|
2009-10-18 06:36:08 -07:00
|
|
|
Gui::ImageButton *m_galaxyButton;
|
2011-07-22 10:36:44 -07:00
|
|
|
Gui::TextEntry *m_searchBox;
|
2008-06-24 17:00:14 -07:00
|
|
|
GLuint m_gluDiskDlist;
|
2009-10-20 09:47:54 -07:00
|
|
|
|
2011-01-19 21:07:28 -08:00
|
|
|
Gui::LabelSet *m_clickableLabels;
|
2011-07-03 23:18:18 -07:00
|
|
|
|
2011-08-10 03:20:32 -07:00
|
|
|
Gui::VBox *m_infoBox;
|
2011-08-11 16:20:22 -07:00
|
|
|
bool m_infoBoxVisible;
|
2011-08-10 03:20:32 -07:00
|
|
|
|
|
|
|
SystemLabels m_currentSystemLabels;
|
|
|
|
SystemLabels m_selectedSystemLabels;
|
|
|
|
SystemLabels m_targetSystemLabels;
|
|
|
|
|
2011-08-14 04:09:14 -07:00
|
|
|
Gui::Label *m_hyperspaceLockLabel;
|
|
|
|
|
2010-03-14 04:28:21 -07:00
|
|
|
sigc::connection m_onMouseButtonDown;
|
2011-07-03 23:18:18 -07:00
|
|
|
sigc::connection m_onKeyPressConnection;
|
2011-06-20 03:25:49 -07:00
|
|
|
|
2011-06-27 04:46:28 -07:00
|
|
|
std::map<SystemPath,Sector*> m_sectorCache;
|
2008-06-24 03:17:31 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _SECTORVIEW_H */
|