colobot/colobot-base/ui/debug_menu.h

103 lines
3.0 KiB
C
Raw Normal View History

2016-03-28 11:51:39 +00:00
/*
* This file is part of the Colobot: Gold Edition source code
2023-08-06 21:15:48 +00:00
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
2016-03-28 11:51:39 +00:00
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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
*/
#pragma once
#include "object/object_type.h"
#include <glm/glm.hpp>
2016-03-28 11:51:39 +00:00
class CRobotMain;
class CObjectManager;
2016-04-03 11:06:39 +00:00
class CSoundInterface;
2016-03-28 11:51:39 +00:00
struct Event;
namespace Gfx
{
class CEngine;
}
namespace Ui
{
class CInterface;
/**
* \class CDebugMenu
* \brief Handles debug menu (F10)
*
* There should always be only one instance of this class for each associated CRobotMain class.
*/
2016-03-28 11:51:39 +00:00
class CDebugMenu
{
public:
//! Creates the CDebugMenu instance
2016-03-28 11:51:39 +00:00
CDebugMenu(CRobotMain* main, Gfx::CEngine* engine, CObjectManager* objMan, CSoundInterface* sound);
//! Destroys the CDebugMenu instance
//! \note Does not clean up the interface, should be called only when CRobotMain is destroyed
2016-03-28 11:51:39 +00:00
virtual ~CDebugMenu();
//! Toggle the debug interface
2016-03-28 11:51:39 +00:00
void ToggleInterface();
//! Check if the debug interface is open
bool IsActive();
//! Event processing
2016-03-28 11:51:39 +00:00
bool EventProcess(const Event& event);
protected:
//! Create the main page of debug interface
2016-03-28 11:51:39 +00:00
void CreateInterface();
//! Create the spawn object interface
2016-03-28 11:51:39 +00:00
void CreateSpawnInterface();
//! Update controls in the debug interface
2016-03-28 11:51:39 +00:00
void UpdateInterface();
//! Destroy the debug interface window
2016-03-28 11:51:39 +00:00
void DestroyInterface();
//! Handle frame update
//! This is used to update the cursor coordinates overlay
void HandleFrameUpdate(const Event &event);
//! Handle spawning a new object at mouse position
//! \return true on success, false on error
bool HandleSpawnObject(ObjectType type, const glm::vec2& mousePos);
//! Handle lightning at position
//! \return true on success, false on error
bool HandleLightning(const glm::vec2& mousePos);
//! Handle teleport to position
//! \return true on success, false on error
bool HandleTeleport(const glm::vec2& mousePos);
//! Handle ctrl+c (copy coordinates under cursor to clipboard)
//! \return true on success, false on error
bool HandleCopy(const glm::vec2& mousePos);
2016-03-28 11:51:39 +00:00
protected:
CRobotMain* m_main;
CInterface* m_interface;
Gfx::CEngine* m_engine;
CObjectManager* m_objMan;
CSoundInterface* m_sound;
ObjectType m_spawningType = OBJECT_NULL;
bool m_lightningActive = false;
bool m_teleportActive = false;
};
}