1 /* Copyright (C) 2023 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef INCLUDED_GAMEVIEW
19 #define INCLUDED_GAMEVIEW
21 #include "renderer/backend/IDeviceCommandContext.h"
22 #include "renderer/Scene.h"
23 #include "simulation2/system/Entity.h"
25 #include "lib/input.h" // InReaction - can't forward-declare enum
36 class CGameView
: private Scene
38 NONCOPYABLE(CGameView
);
40 CGameView(Renderer::Backend::IDevice
* device
, CGame
*pGame
);
41 ~CGameView() override
;
43 void SetViewport(const SViewPort
& vp
);
48 * Updates all the view information (i.e. rotate camera, scroll, whatever). This will *not* change any
49 * World information - only the *presentation*.
51 * @param deltaRealTime Elapsed real time since the last frame.
53 void Update(const float deltaRealTime
);
56 void Prepare(Renderer::Backend::IDeviceCommandContext
* deviceCommandContext
);
57 void Render(Renderer::Backend::IDeviceCommandContext
* deviceCommandContext
);
58 void RenderOverlays(Renderer::Backend::IDeviceCommandContext
* deviceCommandContext
);
60 InReaction
HandleEvent(const SDL_Event_
* ev
);
62 CVector3D
GetCameraPivot() const;
63 CVector3D
GetCameraPosition() const;
64 CVector3D
GetCameraRotation() const;
65 float GetCameraZoom() const;
67 void SetCamera(const CVector3D
& pos
, float rotX
, float rotY
, float zoom
);
68 void MoveCameraTarget(const CVector3D
& target
);
69 void ResetCameraTarget(const CVector3D
& target
);
70 void FollowEntity(entity_id_t entity
, bool firstPerson
);
71 entity_id_t
GetFollowedEntity();
73 #define DECLARE_BOOLEAN_SETTING(NAME) \
74 bool Get##NAME##Enabled() const; \
75 void Set##NAME##Enabled(bool Enabled);
77 DECLARE_BOOLEAN_SETTING(Culling
);
78 DECLARE_BOOLEAN_SETTING(LockCullCamera
);
79 DECLARE_BOOLEAN_SETTING(ConstrainCamera
);
81 #undef DECLARE_BOOLEAN_SETTING
84 CCinemaManager
* GetCinema();
85 CObjectManager
& GetObjectManager();
87 // Implementations of Scene
88 void EnumerateObjects(const CFrustum
& frustum
, SceneCollector
* c
) override
;
89 CLOSTexture
& GetLOSTexture() override
;
90 CTerritoryTexture
& GetTerritoryTexture() override
;
91 CMiniMapTexture
& GetMiniMapTexture() override
;
94 // Unloads all graphics resources loaded by RegisterInit.
95 void UnloadResources();
100 extern InReaction
game_view_handler(const SDL_Event_
* ev
);
102 #endif // INCLUDED_GAMEVIEW