diff options
author | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:19:41 +0100 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2013-11-24 15:19:41 +0100 |
commit | 675b4aa878f16291ce33fced48a2bc7425f635ae (patch) | |
tree | 409914df27a98f65adf866da669429c4de141b6f /source/UI/WindowOwner.h | |
parent | LineBlockTracer: Using the coord-based block faces. (diff) | |
download | cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.gz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.bz2 cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.lz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.xz cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.zst cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.zip |
Diffstat (limited to 'source/UI/WindowOwner.h')
-rw-r--r-- | source/UI/WindowOwner.h | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/source/UI/WindowOwner.h b/source/UI/WindowOwner.h deleted file mode 100644 index d41abf66d..000000000 --- a/source/UI/WindowOwner.h +++ /dev/null @@ -1,125 +0,0 @@ - -#pragma once - -#include "../BlockEntities/BlockEntity.h" -#include "../Entities/Entity.h" -#include "Window.h" - -/* -Being a descendant of cWindowOwner means that the class can own one window. That window can be -queried, opened by other players, closed by players and finally destroyed. -Also, a cWindowOwner can be queried for the block coords where the window is displayed. That will be used -for entities / players in motion to close their windows when they get too far away from the window "source". -*/ - - - - - -// class cWindow; - - - - - -/** -Base class for the window owning -*/ -class cWindowOwner -{ -public: - cWindowOwner() : - m_Window(NULL) - { - } - - void CloseWindow(void) - { - m_Window = NULL; - } - - void OpenWindow(cWindow * a_Window) - { - m_Window = a_Window; - m_Window->SetOwner(this); - } - - cWindow * GetWindow(void) const - { - return m_Window; - } - - /// Returns the block position at which the element owning the window is - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) = 0; - -private: - cWindow * m_Window; -} ; - - - - - -/** -Window owner that is associated with a block entity (chest, furnace, ...) -*/ -class cBlockEntityWindowOwner : - public cWindowOwner -{ -public: - cBlockEntityWindowOwner(void) : - m_BlockEntity(NULL) - { - } - - void SetBlockEntity(cBlockEntity * a_BlockEntity) - { - m_BlockEntity = a_BlockEntity; - } - - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) override - { - a_BlockX = m_BlockEntity->GetPosX(); - a_BlockY = m_BlockEntity->GetPosY(); - a_BlockZ = m_BlockEntity->GetPosZ(); - } - -private: - cBlockEntity * m_BlockEntity; -} ; - - - - - -/** -Window owner that is associated with an entity (chest minecart) -*/ -class cEntityWindowOwner : - public cWindowOwner -{ -public: - cEntityWindowOwner(void) : - m_Entity(NULL) - { - } - - void SetEntity(cEntity * a_Entity) - { - m_Entity = a_Entity; - } - - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) override - { - a_BlockX = (int)floor(m_Entity->GetPosX() + 0.5); - a_BlockY = (int)floor(m_Entity->GetPosY() + 0.5); - a_BlockZ = (int)floor(m_Entity->GetPosZ() + 0.5); - } - -private: - cEntity * m_Entity; -} ; - - - - |