File: spaceObjects.hpp

package info (click to toggle)
marsshooter 0.7.6-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,812 kB
  • sloc: cpp: 20,216; xml: 29; makefile: 8
file content (62 lines) | stat: -rw-r--r-- 2,406 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* spaceObjects.hpp

Copyright (c) 2010 - 2011 by Felix Lauer and Simon Schneegans

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://www.gnu.org/licenses/>. */

# ifndef SPACEOBJECTS_HPP_INCLUDED
# define SPACEOBJECTS_HPP_INCLUDED

# define HOME_LEFT   0
# define HOME_RIGHT  1
# define HOME_MIDDLE 2
# define HOME_RALLY  3

# include "System/Color3f.hpp"
# include "System/Vector2f.hpp"

class Home;
class SpaceObject;

namespace spaceObjects {
    enum ObjectType {oPlanet, oSun, oBlackHole, oHome, oShip, oBall, oFuel, oAmmoAFK47, oAmmoROFLE, oAmmoShotgun,
                     oMud, oSmoke, oEruption, oDust, oExplode, oFragment, oBurningFragment, oFragmentFlame,
                     oMiniFlame, oAmmoFlubba, oMiniAmmoFlubba, oCannonBall, oSpark, oAmmoBurner, oAmmoH2OMG, oHeat,
                     oHeatJet, oShockWave, oHeatBurner, oMiniFlameSmoke, oAmmoRocket, oPowerUpCollect, oAmmoFist,
                     oNumber, oAmmoInsta, oStar};

    void update();
    void draw();

    void  addPlanet();
    void  addPlanet(Vector2f const& location, float radius);
    void  addSun();
    void  addBlackHole();
    Home* addHome(int where, int life, Color3f const& color);
    Home* addHome(Vector2f const& location, int life, Color3f const& color, float radius, float mass);

    SpaceObject const* getObstacle(Vector2f const& start, Vector2f const& end, bool avoidBall = false, float minDistance = 0.f);
    bool               isOnLine   (Vector2f const& source, Vector2f const& direction, Vector2f const& target, float maxAngle);

    std::vector<Home*>const&                getHomes();
    std::vector<SpaceObject*> const&        getObjects();

    /// Populates the space with planets, suns and black holes.
    void populateSpace(float holePercentage, float sunPercentage, int maxObjects);

    void clear();
}

# endif // SPACEOBJECTS_HPP_INCLUDED