neoGFX
C++ GPU-oriented GUI library and app/game creation framework.
i_game_object.hpp
Go to the documentation of this file.
1
// i_game_object.hpp
2
/*
3
neogfx C++ GUI Library
4
Copyright (c) 2015 Leigh Johnston. All Rights Reserved.
5
6
This program is free software: you can redistribute it and / or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
#pragma once
20
21
#include <
neogfx/neogfx.hpp
>
22
#include <
neolib/uuid.hpp
>
23
24
namespace
neogfx
25
{
26
enum class
object_category
27
{
28
Sprite
,
29
PhysicalObject
,
30
Custom
,
31
Shape
// Shape must sort last
32
};
33
34
typedef
neolib::uuid
object_type
;
35
36
class
i_shape
;
37
class
i_collidable_object
;
38
class
i_physical_object
;
39
40
class
i_game_object
41
{
42
public
:
43
struct
not_a_shape
: std::logic_error {
not_a_shape
() : std::logic_error(
"neogfx::i_game_object::not_a_shape"
) {} };
44
struct
not_a_collidable_object
: std::logic_error {
not_a_collidable_object
() : std::logic_error(
"neogfx::i_game_object::not_a_collidable_object"
) {} };
45
struct
not_a_physical_object
: std::logic_error {
not_a_physical_object
() : std::logic_error(
"neogfx::i_game_object::not_a_physical_object"
) {} };
46
struct
not_implemented
: std::logic_error {
not_implemented
() : std::logic_error(
"neogfx::i_game_object::not_implemented"
) {} };
47
public
:
48
virtual
~i_game_object
() {}
49
public
:
50
virtual
object_category
category()
const
= 0;
51
virtual
const
i_shape
& as_shape()
const
= 0;
52
virtual
i_shape
& as_shape() = 0;
53
virtual
const
i_collidable_object
& as_collidable_object()
const
= 0;
54
virtual
i_collidable_object
& as_collidable_object() = 0;
55
virtual
const
i_physical_object
& as_physical_object()
const
= 0;
56
virtual
i_physical_object
& as_physical_object() = 0;
57
virtual
const
object_type&
type
()
const
{
static
object_type sNullTypeId = {};
return
sNullTypeId; }
58
virtual
bool
killed()
const
= 0;
59
virtual
void
kill() = 0;
60
};
61
}
neogfx::i_game_object
Definition:
i_game_object.hpp:40
neogfx::i_game_object::not_a_shape::not_a_shape
not_a_shape()
Definition:
i_game_object.hpp:43
neogfx::Custom
Definition:
i_item_model.hpp:50
neogfx::object_category::Sprite
neogfx::i_game_object::not_a_physical_object::not_a_physical_object
not_a_physical_object()
Definition:
i_game_object.hpp:45
neogfx::object_category::PhysicalObject
neogfx::i_collidable_object
Definition:
i_collidable_object.hpp:27
neogfx.hpp
neogfx::i_physical_object
Definition:
i_physical_object.hpp:30
neogfx::i_game_object::not_a_collidable_object
Definition:
i_game_object.hpp:44
neogfx::i_game_object::not_implemented
Definition:
i_game_object.hpp:46
neogfx
Definition:
action.hpp:26
neogfx::i_game_object::not_a_shape
Definition:
i_game_object.hpp:43
neogfx::i_game_object::not_a_collidable_object::not_a_collidable_object
not_a_collidable_object()
Definition:
i_game_object.hpp:44
neolib::uuid
Definition:
uuid.hpp:51
neogfx::object_category
object_category
Definition:
i_game_object.hpp:26
neogfx::i_game_object::not_a_physical_object
Definition:
i_game_object.hpp:45
neogfx::object_type
neolib::uuid object_type
Definition:
i_game_object.hpp:34
neogfx::i_game_object::not_implemented::not_implemented
not_implemented()
Definition:
i_game_object.hpp:46
neogfx::i_shape
Definition:
i_shape.hpp:58
neogfx::i_game_object::type
virtual const object_type & type() const
Definition:
i_game_object.hpp:57
uuid.hpp
neogfx::i_game_object::~i_game_object
virtual ~i_game_object()
Definition:
i_game_object.hpp:48
neogfx::object_category::Shape
include
neogfx
game
i_game_object.hpp
Generated by
1.8.13