0ad/source/tools/atlas/GameInterface/View.h
Ralph Sennhauser 73ca3d303b
Fix some includes in atlas
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.

Add "source" to include path for AtlasUI target to allow for absolute
includes. In the future all but one should be removed.

Drop check for at least boost 1.40.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-09 06:52:41 +02:00

156 lines
4.7 KiB
C++

/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. 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 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. 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 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_VIEW
#define INCLUDED_VIEW
#include "graphics/Camera.h"
#include "maths/Rect.h"
#include "maths/Vector3D.h"
#include "simulation2/system/Entity.h"
#include "tools/atlas/GameInterface/SharedTypes.h"
#include <cstddef>
#include <map>
#include <string>
class AtlasViewActor;
class AtlasViewGame;
class CCanvas2D;
class CSimulation2;
/**
* Superclass for all Atlas game views.
*/
class AtlasView
{
public:
virtual ~AtlasView();
virtual void Update(float /*realFrameLength*/) { };
virtual void Render() { };
virtual void DrawCinemaPathTool() { };
virtual void DrawOverlays(CCanvas2D& /*canvas*/) { };
virtual CCamera& GetCamera() = 0;
virtual CSimulation2* GetSimulation2() { return NULL; }
virtual entity_id_t GetEntityId(AtlasMessage::ObjectID obj) { return (entity_id_t)obj; }
virtual bool WantsHighFramerate() { return false; }
virtual void SetEnabled(bool /*enabled*/) {}
virtual void SetParam(const std::wstring& name, bool value);
virtual void SetParam(const std::wstring& name, int value);
virtual void SetParam(const std::wstring& /*name*/, float /*value*/) {}
virtual void SetParam(const std::wstring& name, const AtlasMessage::Color& value);
virtual void SetParam(const std::wstring& name, const std::wstring& value);
// These always return a valid (not NULL) object
static AtlasView* GetView(int /*eRenderView*/ view);
static AtlasView* GetView_None();
static AtlasViewGame* GetView_Game();
static AtlasViewActor* GetView_Actor();
// Invalidates any AtlasView objects previously returned by this class
static void DestroyViews();
};
//////////////////////////////////////////////////////////////////////////
class AtlasViewNone : public AtlasView
{
public:
virtual CCamera& GetCamera() { return dummyCamera; }
private:
CCamera dummyCamera;
};
//////////////////////////////////////////////////////////////////////////
class SimState;
/**
* Main editor/game view of Atlas. Editing the world/scenario and simulation testing happens here.
*/
class AtlasViewGame : public AtlasView
{
public:
AtlasViewGame();
virtual ~AtlasViewGame();
virtual void Update(float realFrameLength);
virtual void Render();
virtual void DrawCinemaPathTool();
virtual void DrawOverlays(CCanvas2D& canvas);
virtual CCamera& GetCamera();
virtual CSimulation2* GetSimulation2();
virtual bool WantsHighFramerate();
virtual void SetParam(const std::wstring& name, bool value);
virtual void SetParam(const std::wstring& name, float value);
virtual void SetParam(const std::wstring& name, const std::wstring& value);
void SetSpeedMultiplier(float speedMultiplier);
void SetTesting(bool testing);
void SaveState(const std::wstring& label);
void RestoreState(const std::wstring& label);
std::wstring DumpState(bool binary);
void SetBandbox(bool visible, float x0, float y0, float x1, float y1);
private:
float m_SpeedMultiplier;
bool m_IsTesting;
std::map<std::wstring, SimState*> m_SavedStates;
std::string m_DisplayPassability;
CRect m_Bandbox;
bool m_DrawMoveTool;
CVector3D m_MoveTool;
};
//////////////////////////////////////////////////////////////////////////
class ActorViewer;
/**
* Actor Viewer window in Atlas. Dedicated view for examining a single actor/entity and its variations,
* animations, etc. in more detail.
*/
class AtlasViewActor : public AtlasView
{
public:
AtlasViewActor();
~AtlasViewActor();
virtual void Update(float realFrameLength);
virtual void Render();
virtual CCamera& GetCamera();
virtual CSimulation2* GetSimulation2();
virtual entity_id_t GetEntityId(AtlasMessage::ObjectID obj);
virtual bool WantsHighFramerate();
virtual void SetEnabled(bool enabled);
virtual void SetParam(const std::wstring& name, bool value);
virtual void SetParam(const std::wstring& name, int value);
virtual void SetParam(const std::wstring& name, const AtlasMessage::Color& value);
void SetSpeedMultiplier(float speedMultiplier);
ActorViewer& GetActorViewer();
private:
float m_SpeedMultiplier;
CCamera m_Camera;
ActorViewer* m_ActorViewer;
};
#endif // INCLUDED_VIEW