10 m_pTexture = resourceManager.
Load<
Texture>(
"Textures\\PlayerShip.png");
33 if (input.
IsKeyDown(Key::Right)) direction.
X++;
37 if (direction.
X != 0 && direction.
Y != 0)
78 if (m_isConfinedToScreen)
80 const int PADDING = 4;
81 const int TOP = PADDING;
82 const int Left = PADDING;
131 m_responsiveness =
Math::Clamp(0, 1, responsiveness);
virtual void TranslatePosition(const float x, const float y)
virtual void SetPosition(const float x, const float y)
virtual bool IsActive() const
Flag to determine if the object is active.
static Level * GetCurrentLevel()
Get the current level.
virtual Vector2 & GetPosition()
Get the position of the object.
Represents a 2D grid of texels.
virtual void SetVolume(const float volume)
static const Color White
White.
static int GetScreenHeight()
Gets the screen width in pixels.
static int GetScreenWidth()
Gets the screen width in pixels.
static Vector2 GetScreenCenter()
Gets the screen size in pixels.
Contains timing values for game updates and rendering.
double GetElapsedTime() const
Gets the time in seconds since last frame.
static T Clamp(const T min, const T max, const T value)
Restricts a value to be within a specified range.
static const float NORMALIZE_PI_OVER4
Represents the value of each component in a pi/4 unit vector.
Loads and manages the lifespan of objects from external files.
T * Load(const std::string &path, const bool cache=true, const bool appendContentPath=true)
Load and manage a resource.
Enables a group of sprites to be drawn using the same settings.
void Draw(const Texture *pTexture, const Vector2 position, const Region region, const Color color=Color::White, const Vector2 origin=Vector2::ZERO, const Vector2 scale=Vector2::ONE, const float rotation=0, const float drawDepth=0)
Adds a sprite to a batch of sprites to be rendered.
Represents a 2D grid of texels.
Vector2 GetCenter() const
Gets the center position of the texture.
Defines a vector with 2 components (x and y).
float Y
The y-coordinate of the vector.
static const Vector2 UNIT_Y
A unit vector on the y-axis.
static const Vector2 ZERO
A vector with both of its components set to zero.
static Vector2 Lerp(const Vector2 &start, const Vector2 &end, const float value)
Linearly interpolate between two vectors.
float X
The x-coordinate of the vector.
Represents a level in the game.
virtual float GetAlpha() const
Get the alpha value of the screen.
virtual void ConfineToScreen(const bool isConfined=true)
Prevents the player ship from moving off the screen.
virtual void HandleInput(const InputState &input)
Handles input for the player ship.
virtual void SetResponsiveness(const float responsiveness)
Sets the responsiveness of the player ship.
virtual Vector2 GetHalfDimensions() const
Gets the half dimensions of the player ship.
virtual float GetResponsiveness() const
Gets the responsiveness of the player ship.
virtual void LoadContent(ResourceManager &resourceManager)
Loads the content for the player ship.
virtual void Draw(SpriteBatch &spriteBatch)
Draws the player ship.
virtual void SetDesiredDirection(const Vector2 direction)
Sets the desired direction of the player ship, based on input.
virtual void Update(const GameTime &gameTime)
Updates the player ship.
virtual void Update(const GameTime &gameTime)
Updates the ship.
virtual void Initialize()
Initializes the ship.
virtual void FireWeapons(TriggerType type=TriggerType::All)
Fires the ship's weapons.
virtual Weapon * GetWeapon(const std::string &key)
Gets a weapon from the ship's weapon list.
virtual float GetSpeed() const
Gets the speed of the ship.
Represents a type of trigger, which can be used to activate weapons.
static const TriggerType None
static const TriggerType Primary
virtual void SetFireSound(AudioSample *pSound)
Set the sound that will be played when the weapon is fired.