Class gridpp::shapes::Shape¶
ClassList > gridpp > shapes > Shape
基本圖形的共用基底;圖形會置中於所在格。
#include <GridShapes.h>
Inherits the following classes: gridpp::GridObject
Inherited by the following classes: gridpp::shapes::Circle, gridpp::shapes::Pentagon, gridpp::shapes::Square, gridpp::shapes::Star, gridpp::shapes::Triangle
Public Functions¶
| Type | Name |
|---|---|
| void | set_size (int size) 設定圖形外接框的像素寬度。 |
| int | size () const |
Public Functions inherited from gridpp::GridObject¶
| Type | Name |
|---|---|
| GridObject () = default |
|
| GridObject (std::string asset_name, int x, int y) |
|
| GridObject (const GridObject & other) 複本不屬於任何 GridEngine。 |
|
| void | Move (int dx, int dy) |
| virtual void | OnCollide (GridObject * other) 與另一個可見物件位於同一個有效網格座標時呼叫。 |
| virtual void | OnSpawn () 物件加入引擎後呼叫一次。 |
| virtual void | OnUpdate () 每幀更新時呼叫。 |
| virtual void | Render (GridEngine * engine) 繪製物件。預設使用物件的素材、方向與顏色繪製所在格。 |
| const std::string & | asset_name () const |
| int | direction () const |
| GridEngine * | engine () const |
| GridObject & | operator= (const GridObject & other) = delete |
| void | set_asset_name (const std::string & asset_name) |
| void | set_direction (int direction) 每增加 1 逆時針旋轉 90 度;輸入會正規化至 0 到 3。 |
| void | set_tag (const std::string & tag) |
| void | set_tint (Color tint) |
| void | set_visible (bool visible) 隱藏的物件仍會更新,但不會繪製或參與碰撞。 |
| void | set_x (int x) |
| void | set_y (int y) |
| void | set_z_index (int z_index) 數值越大越晚繪製;相同數值保持 Spawn 順序。 |
| const std::string & | tag () const 可用於碰撞時辨識物件。 |
| Color | tint () const |
| bool | visible () const |
| int | x () const |
| int | y () const |
| int | z_index () const |
| virtual | ~GridObject () = default |
Protected Functions¶
| Type | Name |
|---|---|
| Vector2 | Center (GridEngine * engine) const |
| Shape (int x, int y, int size, Color color) |
Public Functions Documentation¶
function set_size¶
設定圖形外接框的像素寬度。
Parameters:
size新的像素寬度。
Exception:
std::invalid_argument若 size 小於 1。
function size¶
Protected Functions Documentation¶
function Center¶
function Shape¶
The documentation for this class was generated from the following file GridShapes.h