SetPicture

Category: Objects / Display
Since engine version: 1.0 OC

Description

Changes the representative picture of the object by setting it to a new source rectangle within the definition graphics. This picture is used e.g. in menus or the inventory. Also see the Picture entry in DefCore.txt.

Syntax

void SetPicture(int x, int y, int width, int height);

Parameters

x:
X position of the top left corner of the new graphics rectangle.
y:
Y position of the top left corner of the new graphics rectangle.
width:
Width of the new graphics rectangle.
height:
Height of the new graphics rectangle.

Example

global func SetObjectPicture(idSrcDef, obj)
  {
  obj->SetPicture(GetDefCoreVal("Picture", "DefCore", idSrcDef, 0),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 1),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 2),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 3));
  obj->SetGraphics(0, idSrcDef);
  return 1;
  }
Global function: changes the picture of obj to that of another object (Warning: this may make the game graphics or SolidMasks of the object invalid).
See also: SetGraphics
Sven2, 2003-06