pioneer/src/SectorView.h

122 lines
3.1 KiB
C
Raw Normal View History

2012-09-12 04:38:30 -07:00
// Copyright © 2008-2012 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See COPYING.txt for details
#ifndef _SECTORVIEW_H
#define _SECTORVIEW_H
#include "libs.h"
2011-05-21 07:37:01 -07:00
#include "gui/Gui.h"
#include "View.h"
#include <vector>
#include <string>
#include "View.h"
#include "galaxy/Sector.h"
#include "galaxy/SystemPath.h"
#include "graphics/Drawables.h"
class SectorView: public View {
public:
SectorView();
SectorView(Serializer::Reader &rd);
virtual ~SectorView();
virtual void Update();
virtual void ShowAll();
virtual void Draw3D();
vector3f GetPosition() const { return m_pos; }
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);
void FloatHyperspaceTarget();
void ResetHyperspaceTarget();
void GotoSector(const SystemPath &path);
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); }
virtual void Save(Serializer::Writer &wr);
virtual void OnSwitchTo();
sigc::signal<void> onHyperspaceTargetChanged;
private:
void InitDefaults();
void InitObject();
struct SystemLabels {
Gui::Label *systemName;
Gui::Label *distance;
Gui::Label *starType;
Gui::Label *shortDesc;
};
void DrawSector(int x, int y, int z, const vector3f &playerAbsPos, const matrix4x4f &trans);
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);
void OnClickSystem(const SystemPath &path);
2011-07-03 23:18:18 -07:00
void UpdateSystemLabels(SystemLabels &labels, const SystemPath &path);
void UpdateHyperspaceLockLabel();
2011-07-18 06:27:00 -07:00
Sector* GetCached(int sectorX, int sectorY, int sectorZ);
void ShrinkCache();
2011-08-19 01:58:35 -07:00
void MouseButtonDown(int button, int x, int y);
void OnKeyPressed(SDL_keysym *keysym);
2011-08-19 01:58:35 -07:00
void OnSearchBoxKeyPress(const SDL_keysym *keysym);
bool m_inSystem;
2011-08-10 04:07:08 -07:00
SystemPath m_current;
SystemPath m_selected;
2011-07-18 06:27:00 -07:00
vector3f m_pos;
vector3f m_posMovingTo;
float m_rotXDefault, m_rotZDefault, m_zoomDefault;
float m_rotX, m_rotZ;
float m_rotXMovingTo, m_rotZMovingTo;
2011-08-15 14:49:19 -07:00
float m_zoom;
float m_zoomMovingTo;
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;
Gui::Label *m_sectorLabel;
Gui::Label *m_distanceLabel;
Gui::ImageButton *m_zoomInButton;
Gui::ImageButton *m_zoomOutButton;
Gui::ImageButton *m_galaxyButton;
Gui::TextEntry *m_searchBox;
2012-08-04 13:47:56 -07:00
ScopedPtr<Graphics::Drawables::Disk> m_disk;
Gui::LabelSet *m_clickableLabels;
2011-07-03 23:18:18 -07:00
Gui::VBox *m_infoBox;
2011-08-11 16:20:22 -07:00
bool m_infoBoxVisible;
SystemLabels m_currentSystemLabels;
SystemLabels m_selectedSystemLabels;
SystemLabels m_targetSystemLabels;
2011-08-14 04:09:14 -07:00
Gui::Label *m_hyperspaceLockLabel;
sigc::connection m_onMouseButtonDown;
2011-07-03 23:18:18 -07:00
sigc::connection m_onKeyPressConnection;
2011-06-27 04:46:28 -07:00
std::map<SystemPath,Sector*> m_sectorCache;
std::string m_previousSearch;
float m_playerHyperspaceRange;
Graphics::Drawables::Line3D m_jumpLine;
};
#endif /* _SECTORVIEW_H */