Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup|Refactor|World|Client: Added a (stub) ClSkyPlane class
Cleaning up the world::Map API a little more.
- Loading branch information
1 parent
30d519e
commit cd87d77
Showing
9 changed files
with
310 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** @file clskyplane.h Client-side world map sky plane. | ||
* @ingroup world | ||
* | ||
* @authors Copyright © 2016 Daniel Swanson <danij@dengine.net> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>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 2 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, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA</small> | ||
*/ | ||
|
||
#ifndef DENG_CLIENT_WORLD_CLSKYPLANE_H | ||
#define DENG_CLIENT_WORLD_CLSKYPLANE_H | ||
|
||
#include <de/Observers> | ||
|
||
namespace world { | ||
|
||
/** | ||
* | ||
*/ | ||
class ClSkyPlane | ||
{ | ||
public: | ||
/// Notified whenever a @em height change occurs. | ||
DENG2_DEFINE_AUDIENCE2(HeightChange, void clSkyPlaneHeightChanged(ClSkyPlane &skyPlane)) | ||
|
||
ClSkyPlane(bool isCeiling = false, de::ddouble defaultHeight = 0); | ||
|
||
/** | ||
* Returns @c true if this sky plane is configured as the "ceiling". | ||
* | ||
* @see isFloor() | ||
*/ | ||
bool isCeiling() const; | ||
|
||
/** | ||
* Returns @c true if this sky plane is configured as the "ceiling". | ||
* | ||
* @see isCeiling() | ||
*/ | ||
bool isFloor() const; | ||
|
||
/** | ||
* Returns the current height of the sky plane. | ||
*/ | ||
de::ddouble height() const; | ||
|
||
/** | ||
* Change the height of the sky plane to @a newHeight. The HeightChange audience will | ||
* be notified if a change occurs. | ||
*/ | ||
void setHeight(de::ddouble newHeight); | ||
|
||
private: | ||
DENG2_PRIVATE(d) | ||
}; | ||
|
||
} // namespace world | ||
|
||
#endif // DENG_CLIENT_WORLD_CLSKYPLANE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** @file clskyplane.cpp Client-side world map sky plane. | ||
* | ||
* @authors Copyright © 2016 Daniel Swanson <danij@dengine.net> | ||
* | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* <small>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 2 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, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA</small> | ||
*/ | ||
|
||
#include "client/clskyplane.h" | ||
|
||
using namespace de; | ||
|
||
namespace world { | ||
|
||
DENG2_PIMPL_NOREF(ClSkyPlane) | ||
{ | ||
bool isCeiling = false; ///< @c true if this is the ceiling; otherwise the floor. | ||
ddouble height = 0; | ||
|
||
Impl(bool ceiling, ddouble defaultHeight) | ||
: isCeiling(ceiling), height(defaultHeight) | ||
{} | ||
|
||
DENG2_PIMPL_AUDIENCE(HeightChange) | ||
}; | ||
|
||
DENG2_AUDIENCE_METHOD(ClSkyPlane, HeightChange) | ||
|
||
ClSkyPlane::ClSkyPlane(bool isCeiling, ddouble defaultHeight) | ||
: d(new Impl(isCeiling, defaultHeight)) | ||
{} | ||
|
||
bool ClSkyPlane::isCeiling() const | ||
{ | ||
return d->isCeiling; | ||
} | ||
|
||
bool ClSkyPlane::isFloor() const | ||
{ | ||
return !d->isCeiling; | ||
} | ||
|
||
ddouble ClSkyPlane::height() const | ||
{ | ||
return d->height; | ||
} | ||
|
||
void ClSkyPlane::setHeight(ddouble newHeight) | ||
{ | ||
if (d->height != newHeight) | ||
{ | ||
d->height = newHeight; | ||
DENG2_FOR_AUDIENCE2(HeightChange, i) i->clSkyPlaneHeightChanged(*this); | ||
} | ||
} | ||
|
||
} // namespace world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.