MochiEngine
Loading...
Searching...
No Matches
Mochi::Physics::Rectangle Struct Reference

Class representing a rectangle in space. The position is the center of the rectangle, and the extents is half the size (so, distance between the center and outermost part of the rectangle). This is meant to be used for checking for collisions between different types of shapes. More...

#include <Shapes.h>

Inheritance diagram for Mochi::Physics::Rectangle:
Mochi::Physics::Shape

Public Member Functions

 Rectangle (const Vector2f &position, const Vector2f &extents)
 Rectangle (const Rectf &rect)
virtual std::unique_ptr< Shape > Clone () const override
virtual bool IsColliding (const Shape &other) const override
virtual bool Collides (const Point &p) const override
virtual bool Collides (const Line &l) const override
virtual bool Collides (const Circle &c) const override
virtual bool Collides (const Rectangle &r) const override
Public Member Functions inherited from Mochi::Physics::Shape
 Shape (const Vector2f &position)

Public Attributes

Vector2f Extents
Public Attributes inherited from Mochi::Physics::Shape
Vector2f Position

Detailed Description

Class representing a rectangle in space. The position is the center of the rectangle, and the extents is half the size (so, distance between the center and outermost part of the rectangle). This is meant to be used for checking for collisions between different types of shapes.

Member Function Documentation

◆ Clone()

std::unique_ptr< Shape > Mochi::Physics::Rectangle::Clone ( ) const
overridevirtual

Implements Mochi::Physics::Shape.

◆ Collides() [1/4]

bool Mochi::Physics::Rectangle::Collides ( const Circle & c) const
overridevirtual

Implements Mochi::Physics::Shape.

◆ Collides() [2/4]

bool Mochi::Physics::Rectangle::Collides ( const Line & l) const
overridevirtual

Implements Mochi::Physics::Shape.

◆ Collides() [3/4]

bool Mochi::Physics::Rectangle::Collides ( const Point & p) const
overridevirtual

Implements Mochi::Physics::Shape.

◆ Collides() [4/4]

bool Mochi::Physics::Rectangle::Collides ( const Rectangle & r) const
overridevirtual

Implements Mochi::Physics::Shape.

◆ IsColliding()

bool Mochi::Physics::Rectangle::IsColliding ( const Shape & other) const
overridevirtual

Implements Mochi::Physics::Shape.


The documentation for this struct was generated from the following files:
  • Engine/src/Physics/Shapes.h
  • Engine/src/Physics/Shapes.cpp