Sdk/Console: Add Clear method

Former-commit-id: 6230bf71538d3436cd1c247e9645e54fff0e0a2d
This commit is contained in:
Lynix 2016-04-01 18:57:07 +02:00
parent 9a472a4a1c
commit 8732cc9459
2 changed files with 14 additions and 1 deletions

View File

@ -7,6 +7,8 @@
#ifndef NDK_CONSOLE_HPP #ifndef NDK_CONSOLE_HPP
#define NDK_CONSOLE_HPP #define NDK_CONSOLE_HPP
#include <Nazara/Core/HandledObject.hpp>
#include <Nazara/Core/ObjectHandle.hpp>
#include <Nazara/Graphics/Sprite.hpp> #include <Nazara/Graphics/Sprite.hpp>
#include <Nazara/Graphics/TextSprite.hpp> #include <Nazara/Graphics/TextSprite.hpp>
#include <Nazara/Utility/Event.hpp> #include <Nazara/Utility/Event.hpp>
@ -21,9 +23,12 @@ namespace Nz
namespace Ndk namespace Ndk
{ {
class Console;
class Entity; class Entity;
class NDK_API Console : public Nz::Node using ConsoleHandle = Nz::ObjectHandle<Console>;
class NDK_API Console : public Nz::Node, public Nz::HandledObject<Console>
{ {
public: public:
Console(World& world, const Nz::Vector2f& size, Nz::LuaInstance& instance); Console(World& world, const Nz::Vector2f& size, Nz::LuaInstance& instance);
@ -33,6 +38,8 @@ namespace Ndk
void AddLine(const Nz::String& text, const Nz::Color& color = Nz::Color::White); void AddLine(const Nz::String& text, const Nz::Color& color = Nz::Color::White);
void Clear();
inline unsigned int GetCharacterSize() const; inline unsigned int GetCharacterSize() const;
inline const EntityHandle& GetHistory() const; inline const EntityHandle& GetHistory() const;
inline const EntityHandle& GetHistoryBackground() const; inline const EntityHandle& GetHistoryBackground() const;

View File

@ -92,6 +92,12 @@ namespace Ndk
RefreshHistory(); RefreshHistory();
} }
void Console::Clear()
{
m_historyLines.clear();
RefreshHistory();
}
void Console::SendCharacter(char32_t character) void Console::SendCharacter(char32_t character)
{ {
switch (character) switch (character)