本文整理汇总了C++中gd::PlatformExtension::AddObject方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformExtension::AddObject方法的具体用法?C++ PlatformExtension::AddObject怎么用?C++ PlatformExtension::AddObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::PlatformExtension
的用法示例。
在下文中一共展示了PlatformExtension::AddObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeclareTextObjectExtension
void DeclareTextObjectExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("TextObject",
_("Text object"),
_("Extension allowing to use an object displaying a text."),
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("Text",
_("Text"),
_("Displays a text"),
"CppPlatform/Extensions/texticon.png",
&CreateTextObject);
#if defined(GD_IDE_ONLY)
obj.SetIncludeFile("TextObject/TextObject.h");
obj.AddAction("String",
_("Modify the text"),
_("Modify the text of a Text object."),
_("Do _PARAM1__PARAM2_ to the text of _PARAM0_"),
"",
"res/actions/text24.png",
"res/actions/text.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("string", _("Text"))
.SetFunctionName("SetString").SetManipulatedType("string").SetGetter("GetString").SetIncludeFile("TextObject/TextObject.h");
obj.AddCondition("String",
_("Compare the text"),
_("Compare the text of a Text object."),
_("Text of _PARAM0_ is _PARAM1__PARAM2_"),
"",
"res/conditions/text24.png",
"res/conditions/text.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("string", _("Text to test"))
.SetFunctionName("GetString").SetManipulatedType("string").SetIncludeFile("TextObject/TextObject.h");
obj.AddAction("Font",
_("Font"),
_("Modify the font of the text."),
_("Change font of _PARAM0_ to _PARAM1_"),
_("Font"),
"res/actions/font24.png",
"res/actions/font.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("police", _("Font"))
.SetFunctionName("ChangeFont").SetIncludeFile("TextObject/TextObject.h");
obj.AddAction("Size",
_("Size"),
_("Modify the size of the text."),
_("Do _PARAM1__PARAM2_ to the size of the text of _PARAM0_"),
"",
"res/actions/characterSize24.png",
"res/actions/characterSize.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetFunctionName("SetCharacterSize").SetManipulatedType("number").SetGetter("GetCharacterSize").SetIncludeFile("TextObject/TextObject.h");
obj.AddCondition("Size",
_("Size"),
_("Test the size of the text"),
_("The size of the text of _PARAM0_ is _PARAM1__PARAM2_"),
"",
"res/conditions/characterSize24.png",
"res/conditions/characterSize.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Size to test"))
.SetFunctionName("GetCharacterSize").SetManipulatedType("number").SetIncludeFile("TextObject/TextObject.h");
obj.AddAction("ChangeColor",
_("Color"),
_("Change the color of the text. The color is white by default."),
_("Change color of _PARAM0_ to _PARAM1_"),
_("Effects"),
"res/actions/color24.png",
"res/actions/color.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("color", _("Color"))
.SetFunctionName("SetColor").SetIncludeFile("TextObject/TextObject.h");
obj.AddAction("Opacity",
_("Opacity"),
_("Modify the opacity of a Text object."),
_("Do _PARAM1__PARAM2_ to the opacity of _PARAM0_"),
"",
"res/actions/opacity24.png",
"res/actions/opacity.png")
.AddParameter("object", _("Object"), "Text", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetFunctionName("SetOpacity").SetManipulatedType("number").SetGetter("GetOpacity").SetIncludeFile("TextObject/TextObject.h");
obj.AddCondition("Opacity",
//.........这里部分代码省略.........
示例2: ImplementsSpriteExtension
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("Sprite",
_("Sprite"),
_("Extension for adding animated objects in the scene, which can contain animations with directions within each."),
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("Sprite",
_("Sprite"),
_("Animated object which can be used for most elements of a game"),
"CppPlatform/Extensions/spriteicon.png",
&CreateSpriteObject);
#if defined(GD_IDE_ONLY)
obj.AddAction("Opacity",
_("Change object's opacity"),
_("Change the opacity of an object."),
_("Do _PARAM1__PARAM2_ to the opacity of _PARAM0_"),
_("Visibility"),
"res/actions/opacity24.png",
"res/actions/opacity.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("ChangeAnimation",
_("Change the animation"),
_("Modify the current animation of the object."),
_("Do _PARAM1__PARAM2_ to the number of current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("ChangeDirection",
_("Change the direction"),
_("Change the direction of the object.\nIf the object is set to automatically rotate, the direction is its angle.\nIf the object is in 8 directions mode, the valid directions are 0..7"),
_("Do _PARAM1__PARAM2_ to the direction of _PARAM0_"),
_("Direction"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("ChangeSprite",
_("Current frame"),
_("Modify the current frame of the object"),
_("Do _PARAM1__PARAM2_ to animation frame of _PARAM0_"),
_("Animations and images"),
"res/actions/sprite24.png",
"res/actions/sprite.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("PauseAnimation",
_("Pause the animation"),
_("Pause the current animation of the object"),
_("Pause the current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddAction("PlayAnimation",
_("Play the animation"),
_("Play the current animation of the object"),
_("Play the current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddAction("ChangeAnimationSpeedScale",
_("Animation speed scale"),
_("Modify the animation speed scale (1 = the default speed, >1 = faster and <1 = slower)."),
_("Do _PARAM1__PARAM2_ to the animation speed scale of _PARAM0_"),
_("Animations and images"),
//.........这里部分代码省略.........
示例3: DeclarePanelSpriteObjectExtension
void DeclarePanelSpriteObjectExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("PanelSpriteObject",
_("Panel Sprite (9-patch) Object"),
_("Extension allowing to use panel sprite (\"9-patch\") objects."),
"Victor Levasseur and Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("PanelSprite",
_("Panel Sprite (\"9-patch\")"),
_("An image with edges and corners that are stretched separately from the fill."),
"CppPlatform/Extensions/PanelSpriteIcon.png",
&CreatePanelSpriteObject);
#if defined(GD_IDE_ONLY)
obj.SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddAction("Width",
_("Width"),
_("Modify the width of a Panel Sprite."),
_("Do _PARAM1__PARAM2_ to the width of _PARAM0_"),
_("Size and angle"),
"res/actions/scaleWidth24.png",
"res/actions/scaleWidth.png")
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetFunctionName("SetWidth").SetManipulatedType("number").SetGetter("GetWidth").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddCondition("Width",
_("Width"),
_("Test the width of a Panel Sprite."),
_("The width of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size and angle"),
"res/conditions/scaleWidth24.png",
"res/conditions/scaleWidth.png")
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.SetFunctionName("GetWidth").SetManipulatedType("number").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddAction("Height",
_("Height"),
_("Modify the height of a Panel Sprite."),
_("Do _PARAM1__PARAM2_ to the height of _PARAM0_"),
_("Size and angle"),
"res/actions/scaleHeight24.png",
"res/actions/scaleHeight.png")
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetFunctionName("SetHeight").SetManipulatedType("number").SetGetter("GetHeight").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddCondition("Height",
_("Height"),
_("Test the height of a Panel Sprite."),
_("The height of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size and angle"),
"res/conditions/scaleHeight24.png",
"res/conditions/scaleHeight.png")
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.SetFunctionName("SetHeight").SetManipulatedType("number").SetGetter("GetHeight").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddAction("Angle",
_("Angle"),
_("Modify the angle of a Panel Sprite."),
_("Do _PARAM1__PARAM2_ to the angle of _PARAM0_"),
_("Size and angle"),
"res/actions/rotate24.png",
"res/actions/rotate.png")
.SetHidden() //Deprecated, now available for all objects
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetFunctionName("SetAngle").SetManipulatedType("number").SetGetter("GetAngle").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddCondition("Angle",
_("Angle"),
_("Test the angle of a Panel Sprite."),
_("The angle of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size and angle"),
"res/conditions/rotate24.png",
"res/conditions/rotate.png")
.SetHidden() //Deprecated, now available for all objects
.AddParameter("object", _("Object"), "PanelSprite", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.SetFunctionName("SetAngle").SetManipulatedType("number").SetGetter("GetAngle").SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
obj.AddAction("Image",
_("Image name"),
_("Change the image of a Panel Sprite."),
_("Set image _PARAM1_ on _PARAM0_"),
_("Image"),
//.........这里部分代码省略.........
示例4: DeclareTileMapObjectExtension
void DeclareTileMapObjectExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("TileMapObject",
_("Tile Map Object"),
_("Extension allowing to use tile map objects."),
"Victor Levasseur and Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("TileMap",
_("Tile Map"),
_("Displays a tile map"),
"CppPlatform/Extensions/TileMapIcon.png",
&CreateTileMapObject);
#if defined(GD_IDE_ONLY)
obj.SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddCondition("Width",
_("Width"),
_("Test the width of a Tile Map Object."),
_("The width of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size"),
"res/conditions/scaleWidth24.png",
"res/conditions/scaleWidth.png")
.AddParameter("object", _("Object"), "TileMap", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetFunctionName("GetWidth").SetManipulatedType("number").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddCondition("Height",
_("Height"),
_("Test the height of a Tile Map Object."),
_("The height of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size"),
"res/conditions/scaleHeight24.png",
"res/conditions/scaleHeight.png")
.AddParameter("object", _("Object"), "TileMap", false)
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetFunctionName("GetHeight").SetManipulatedType("number").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddAction("SetMapSize",
_("Resize the tilemap"),
_("Change the size of the tilemap (number of tiles)."),
_("Resize the tilemap to _PARAM1_x_PARAM2_ tiles"),
_("Size"),
"CppPlatform/Extensions/TileMapIcon24.png",
"res/TileMapIcon16.png")
.AddParameter("objectList", _("Tile Map Object"), "TileMap", false)
.AddParameter("expression", _("Width (tiles count)"))
.AddParameter("expression", _("Height (tiles count)"))
.MarkAsSimple()
.SetFunctionName("SetMapSize").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
extension.AddCondition("SingleTileCollision",
_("Collision with one tile"),
_("Test if an object collides a specific tile."),
_("_PARAM4_ is in collision with the tile at _PARAM2_;_PARAM3_ (layer _PARAM1_) of _PARAM0_"),
_("Collisions"),
"res/conditions/collision24.png",
"res/conditions/collision.png")
.AddParameter("objectList", _("Tile Map Object"), "TileMap", false)
.AddParameter("expression", _("Tile layer (0: Back, 1: Middle, 2: Top)"))
.AddParameter("expression", _("Tile column"))
.AddParameter("expression", _("Tile row"))
.AddParameter("objectList", _("Object"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsSimple()
.SetFunctionName("SingleTileCollision").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddExpression("TileWidth", _("Tile width"), _("Tile width"), _("Tiles"), "res/TileMapIcon16.png")
.AddParameter("object", _("Object"), "TileMap", false)
.SetFunctionName("GetTileWidth").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddExpression("TileHeight", _("Tile height"), _("Tile height"), _("Tiles"), "res/TileMapIcon16.png")
.AddParameter("object", _("Object"), "TileMap", false)
.SetFunctionName("GetTileHeight").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddExpression("MapWidth", _("Map width (tiles)"), _("Map width"), _("Map"), "res/TileMapIcon16.png")
.AddParameter("object", _("Object"), "TileMap", false)
.SetFunctionName("GetMapWidth").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddExpression("MapHeight", _("Map height (tiles)"), _("Map height"), _("Map"), "res/TileMapIcon16.png")
.AddParameter("object", _("Object"), "TileMap", false)
.SetFunctionName("GetMapHeight").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddExpression("GetTile", _("Get the Tile (id)"), _("Get the Tile (id)"), _("Map"), "res/TileMapIcon16.png")
.AddParameter("object", _("Object"), "TileMap", false)
.AddParameter("expression", _("Layer"), "", false)
.AddParameter("expression", _("Column"), "", false)
.AddParameter("expression", _("Row"), "", false)
.SetFunctionName("GetTile").SetIncludeFile("TileMapObject/RuntimeTileMapObject.h");
obj.AddAction("SetTile",
//.........这里部分代码省略.........
示例5: DeclarePrimitiveDrawingExtension
void DeclarePrimitiveDrawingExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("PrimitiveDrawing",
_("Primitive drawing"),
_("Extension allowing to draw shapes and manipulate images."),
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("Drawer", //"Drawer" is kept for compatibility with GD<=3.6.76
_("Shape painter"),
_("Allows to draw simple shapes on the screen"),
"CppPlatform/Extensions/primitivedrawingicon.png",
&CreateShapePainterObject);
#if defined(GD_IDE_ONLY)
ShapePainterObject::LoadEdittimeIcon();
obj.SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("Rectangle",
_("Rectangle"),
_("Draw a rectangle on screen"),
_("Draw from _PARAM1_;_PARAM2_ to _PARAM3_;_PARAM4_ a rectangle with _PARAM0_"),
_("Drawing"),
"res/actions/rectangle24.png",
"res/actions/rectangle.png")
.AddParameter("object", _("Shape Painter object"), "Drawer")
.AddParameter("expression", _("Top left side: X Position"))
.AddParameter("expression", _("Top left side : Y Position"))
.AddParameter("expression", _("Bottom right side : X Position"))
.AddParameter("expression", _("Bottom right side : Y Position"))
.SetFunctionName("DrawRectangle").SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("Circle",
_("Circle"),
_("Draw a circle on screen"),
_("Draw at _PARAM1_;_PARAM2_ a circle of radius _PARAM3_ with _PARAM0_"),
_("Drawing"),
"res/actions/circle24.png",
"res/actions/circle.png")
.AddParameter("object", _("Shape Painter object"), "Drawer")
.AddParameter("expression", _("X position of center"))
.AddParameter("expression", _("Y position of center"))
.AddParameter("expression", _("Radius ( in pixels )"))
.SetFunctionName("DrawCircle").SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("Line",
_("Line"),
_("Draw a line on screen"),
_("Draw from _PARAM1_;_PARAM2_ to _PARAM3_;_PARAM4_ a line (thickness : _PARAM5_) with _PARAM0_"),
_("Drawing"),
"res/actions/line24.png",
"res/actions/line.png")
.AddParameter("object", _("Shape Painter object"), "Drawer")
.AddParameter("expression", _("X Position of start point"))
.AddParameter("expression", _("Y Position of start point"))
.AddParameter("expression", _("X Position of end point"))
.AddParameter("expression", _("Y Position of end point"))
.AddParameter("expression", _("Thickness ( in pixels )"))
.SetFunctionName("DrawLine").SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("FillColor",
_("Fill color"),
_("Change the color of filling"),
_("Change fill color of _PARAM0_ to _PARAM1_"),
_("Setup"),
"res/actions/text24.png",
"res/actions/text.png")
.AddParameter("object", _("Shape Painter object"), "Drawer")
.AddParameter("color", _("Fill color"))
.SetFunctionName("SetFillColor").SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("OutlineColor",
_("Outline color"),
_("Modify the color of the outline of future drawings."),
_("Change outline color of _PARAM0_ to _PARAM1_"),
_("Setup"),
"res/actions/color24.png",
"res/actions/color.png")
.AddParameter("object", _("Shape Painter object"), "Drawer")
.AddParameter("color", _("Color"))
.SetFunctionName("SetOutlineColor").SetIncludeFile("PrimitiveDrawing/ShapePainterObject.h");
obj.AddAction("OutlineSize",
_("Outline size"),
_("Modify the size of the outline of future drawings."),
_("Do _PARAM1__PARAM2_ to the size of the outline of _PARAM0_"),
_("Setup"),
"res/actions/outlineSize24.png",
"res/actions/outlineSize.png")
//.........这里部分代码省略.........