Skip to content

Commit

Permalink
GITBOOK-317: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru authored and gitbook-bot committed Dec 25, 2024
1 parent 970da4a commit 0c60cf0
Show file tree
Hide file tree
Showing 21 changed files with 129 additions and 151 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
* [DataUiGrid](gum-code/gum-code-reference/datauigrid/README.md)
* [Reflection](gum-code/gum-code-reference/datauigrid/reflection.md)
* [Categories](gum-code/gum-code-reference/datauigrid/categories.md)
* [ElementSave](gum-code/gum-code-reference/elementsave.md)
* [GraphicalUiElement](gum-code/gum-code-reference/graphicaluielement/README.md)
* [AddToManagers](gum-code/gum-code-reference/graphicaluielement/addtomanagers.md)
* [AnimateSelf](gum-code/gum-code-reference/graphicaluielement/animateself.md)
Expand Down
16 changes: 2 additions & 14 deletions docs/gum-code/gum-code-reference/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@ Gum uses the following technologies:

## Running from source

For information on running from source, see [Running from Source](https://flatredball.gitbook.io/gum/gum-code-reference/running-from-source).
For information on running from source, see [Running from Source](./#running-from-source).

## Writing Plugins

For information on how to write Gum plugins, visit this page: [Plugins](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/Plugins/README.md)

## Code Reference

* [Gum Class Overview](gum-class-overview.md)
* [Gum.DataTypes.GumProjectSave](gumprojectsave.md)
* [Gum.DataTypes.InstanceSave](instancesave.md)
* [Gum.DataTypes.VariableSave](variablesave.md)
* [Gum.ToolStates.SelectedState](selectedstate.md)
* [Gum.Wireframe.GraphicalUiElement](graphicaluielement/)
* [RenderingLibrary.IPositionedSizedObject](ipositionedsizedobject.md)
* [WpfDataUi.DataUiGrid](datauigrid/)
* [WpfDataUi.IDataUi](idataui.md)
For information on how to write Gum plugins, visit this page: [Plugins](../../readme/plugins/)
5 changes: 5 additions & 0 deletions docs/gum-code/gum-code-reference/elementsave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ElementSave

### Introduction

ElementSave is the base class for ScreenSave, ComponentSave, and StandardElementSave. ElementSave is often used when working with instances of the derived classes due to their similarities, such as referencing instances and states.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ title: GraphicalUiElement

## Introduction

The GraphicalUiElement class represents any visual element in the Gum runtime. An instance of a GraphicalUiElement exists for every instance of the base rendering types (such as [RenderingLibrary.Graphics.Sprite](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/RenderingLibrary.Graphics.Sprite)) as well as instances of components. When loading a .gumx file in a project (such as a MonoGame or FlatRedBall project), each Screen is also a GraphicalUiElement.
The GraphicalUiElement class represents any visual element in the Gum runtime. An instance of a GraphicalUiElement exists for every standard instance as well as instances of components. When loading a .gumx file in a project (such as a MonoGame or FlatRedBall project), each Screen is also a GraphicalUiElement.
9 changes: 4 additions & 5 deletions docs/gum-code/gum-code-reference/idataui.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ title: IDataUi

## Introduction

The IDataUi is an interface that is used by the [WpfDataUi.DataUiGrid](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/WpfDataUi.DataUiGrid)\(WpfDataUi.DataUiGrid\) class to display data. This interface must be implemented by any controls which are used in the [WpfDataUi.DataUiGrid](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/WpfDataUi.DataUiGrid)\(WpfDataUi.DataUiGrid\). The WpfDataUi library contains a number of built-in controls which implement the IDataUi interface, but it can easily be extended to support more controls.
 IDataUi is an interface used by [WpfDataUi.DataUiGrid](datauigrid/) to display data. This interface must be implemented by any controls which are used in the [WpfDataUi.DataUiGrid](datauigrid/). The WpfDataUi library contains a number of built-in controls which implement the IDataUi interface, but it can be extended to support more controls.

## Creating IDataUi Controls

To create a custom display:

1. Add a new User Control \(WPF\)
2. In the codebehind file, implement the IDataUi interface
3. This newly-created control can be used in a WpfDataUi grid by assigning the [WpfDataUi.DataTypes.InstanceMember.PreferredDisplayer](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/WpfDataUi.DataTypes.InstanceMember.PreferredDisplayer) property.

1. Add a new User Control (WPF)
2. In the code behind file, implement the IDataUi interface
3. This newly-created control can be used in a WpfDataUi grid by assigning the WpfDataUi.DataTypes.InstanceMember.PreferredDisplayer property.
6 changes: 3 additions & 3 deletions docs/gum-code/gum-code-reference/instancesave.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ An InstanceSave represents an instance in Gum. InstanceSave only stores two piec
1. The name of the instance
2. The base type of the instance

All InstanceSaves in Gum will be contained in an [ElementSave](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/Gum.DataTypes.ElementSave). Information about the InstanceSave's variables (such as its position or size) is not stored directly on the InstanceSave. The reason for this is because InstanceSaves have variables which depend on [States](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/Gum.DataTypes.StateSave). In other words, an InstanceSave may be at X=0 in one state, and at X=100 in another state.
All InstanceSaves in Gum will be contained in an ElementSave. Information about the InstanceSave's variables (such as its position or size) is not stored directly on the InstanceSave. The reason for this is because InstanceSaves have variables which depend on States. In other words, an InstanceSave may be at X=0 in one state, and at X=100 in another state.

Therefore, all variables values that define the InstanceSave are stored in states within the InstanceSave's container [ElementSave](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/Gum.DataTypes.ElementSave).
Therefore, all variables values that define the InstanceSave are stored in states within the InstanceSave's container ElementSave.

## Example

Expand All @@ -21,7 +21,7 @@ In this pic the Screen1 ScreenSave has 3 InstanceSaves: 1. TextInstance 1. Color

The following code shows how to access the X value of an ElementSave as defined in the default state of its container.

```
```csharp
var container = SelectedState.Self.SelectedScreen;
// This code gets an instance by the name "Title"
var instance = container.Instances.FirstOrDefault(item=>item.Name == "Title");
Expand Down
5 changes: 0 additions & 5 deletions docs/gum-code/gum-code-reference/ipositionedsizedobject.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,3 @@ title: IPositionedSizedObject
## Introduction

The IPositionedSizedObject interface is the interface used by all visual objects in the RenderingLibrary, and it is also used by the GraphicalUiElement object.

## Members

* [RenderingLibrary.IPositionedSizedObject.GetAbsoluteX](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Code%20Reference/RenderingLibrary.IPositionedSizedObject.GetAbsoluteX)

8 changes: 4 additions & 4 deletions docs/readme/gum-elements/container/children-layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Introduction

The **Children Layout** property determines how a container positions its children. The default value is "Regular" which means that children are positioned according to their [X Units](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Units/README.md) and [Y Units](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Y%20Units/README.md).
The **Children Layout** property determines how a container positions its children. The default value is "Regular" which means that children are positioned according to their [X Units](../general-properties/x-units.md) and [Y Units](../general-properties/y-units.md).

<figure><img src="../../../.gitbook/assets/image (47).png" alt=""><figcaption><p>Children Layout showing Regular, Top to Bottom Stack, Left to Right Stack, Auto Grid Horizontal, and Auto Grid Vertical</p></figcaption></figure>

Expand Down Expand Up @@ -70,17 +70,17 @@ Top to Bottom and Left to Right stacks separate their children using the Stack S

### Stacking and Children Origin

In most cases children which are stacked should use a Left [X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md) if the parent uses a **LeftToRightStack** and should use a Top [Y Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Y%20Origin/README.md) if the parent uses a **Top To Bottom Stack**.
In most cases children which are stacked should use a Left [X Origin](../general-properties/x-origin.md) if the parent uses a **LeftToRightStack** and should use a Top [Y Origin](../general-properties/y-origin.md) if the parent uses a **Top To Bottom Stack**.

For example, consider a parent which contains two children - a blue and a red rectangle.

![](<../../../.gitbook/assets/LeftToRightStackLeftOrigin (1).png>)

In the image shown above, the red rectangle is positioned directly to the right of the blue rectangle. Notice that if the red rectangle's [X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md) is changed to **Center**, the red rectangle overlaps the blue rectangle.
In the image shown above, the red rectangle is positioned directly to the right of the blue rectangle. Notice that if the red rectangle's [X Origin](../general-properties/x-origin.md) is changed to **Center**, the red rectangle overlaps the blue rectangle.

![](<../../../.gitbook/assets/LeftToRightOverlapping (1).png>)

If the red rectangle's [X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md) is changed to **Right**, then its right side will align with the right side of the blue rectangle, resulting in the red overlapping the blue completely. In this case the stacking is essentially cancelled out by the [X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md).
If the red rectangle's [X Origin](../general-properties/x-origin.md) is changed to **Right**, then its right side will align with the right side of the blue rectangle, resulting in the red overlapping the blue completely. In this case the stacking is essentially cancelled out by the [X Origin](../general-properties/x-origin.md).

![](../../../.gitbook/assets/LeftToRightCompleteOverlap.png)

Expand Down
10 changes: 5 additions & 5 deletions docs/readme/gum-elements/general-properties/height-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Text instances which use an Absolute height of 0 size themselves to be the heigh

### Relative to Container

The following shows a child [ColoredRectangle](../coloredrectangle.md) with -10 **Relative to Container** Height, which means is sized 10 pixels less tall than its parent.
The following shows a child ColoredRectangle with -10 **Relative to Container** Height, which means is sized 10 pixels less tall than its parent.

![Rectangle using a Relative to Container height value of -10](<../../../.gitbook/assets/11_06 18 55.png>)

Expand All @@ -28,7 +28,7 @@ Despite the name referring to a "Container", the size is relative to the parent

### Percentage of Container

The following shows a child [ColoredRectangle](../coloredrectangle.md) with 100 **Percentage** Height, which means it has 100% of the height of its parent. Note that 100 **Percentage** is the same as 0 **Relative to Container**:
The following shows a child ColoredRectangle with 100 **Percentage** Height, which means it has 100% of the height of its parent. Note that 100 **Percentage** is the same as 0 **Relative to Container**:

![Rectangle using a Percentage of Container value of 100](<../../../.gitbook/assets/11_06 24 44.png>)

Expand Down Expand Up @@ -137,14 +137,14 @@ For example, the following image contains multiple Text instances. Each has a si

**Percentage of Other Dimension** adjusts the object's effective height so it remains proportional to the Width value multiplied by the Height value (as a percentage). For example, if a Height value of 200 is entered, then the effective height is 200% (2x) of the width.

The following image shows a child [ColoredRectangle](../coloredrectangle.md) with a Height of 200 **Percentage of Other Dimension**. In this image, the **Width** value is 50 units, so the effective height is 100 units:
The following image shows a child ColoredRectangle with a Height of 200 **Percentage of Other Dimension**. In this image, the **Width** value is 50 units, so the effective height is 100 units:

<figure><img src="../../../.gitbook/assets/11_06 29 41.png" alt=""><figcaption><p>Rectangle using Percentage of Other Dimension height of 200</p></figcaption></figure>

### Percentage of Source File

The [Sprite](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Sprite/README.md) type has an extra **Height Unit** called **Percentage of Source File**, which sets the height of the Sprite according to the file that it is displaying. This is the default **Height Unit** for Sprites.
The [Sprite](../sprite/) type has an extra **Height Unit** called **Percentage of Source File**, which sets the height of the Sprite according to the file that it is displaying. This is the default **Height Unit** for Sprites.

The following image shows a child [Sprite](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Sprite/README.md) with 200 **Percentage of Source File** Height, which means it draws two times as tall as its source image:
The following image shows a child Sprite with 200 **Percentage of Source File** Height, which means it draws two times as tall as its source image:

![Sprite using Percentage of Source height of 200](<../../../.gitbook/assets/11_06 31 44.png>)
4 changes: 2 additions & 2 deletions docs/readme/gum-elements/general-properties/rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

The Rotation property can be used to rotate Gum components. It is measured in degrees, where positive values rotate an object counterclockwise about its origin ([X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md) and [Y Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Y%20Origin/README.md)).
The Rotation property can be used to rotate Gum components. It is measured in degrees, where positive values rotate an object counterclockwise about its origin ([X Origin](x-origin.md) and [Y Origin](y-origin.md)).

## Example

Expand All @@ -16,6 +16,6 @@ Objects can also be rotated visually by grabbing the rotation handle:

## X Origin and Y Origin

The [X Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/X%20Origin/README.md) and [Y Origin](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Y%20Origin/README.md) properties define the point of rotation for an object. For example, the following shows a rectangle rotated about its center:
The [X Origin](x-origin.md) and [Y Origin](y-origin.md) properties define the point of rotation for an object. For example, the following shows a rectangle rotated about its center:

![](<../../../.gitbook/assets/RotateByCenter (1).gif>)
12 changes: 6 additions & 6 deletions docs/readme/gum-elements/general-properties/width-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ The **Width Units** variable controls how a unit is horizontally sized, which ma

### Absolute

The following shows a child [ColoredRectangle](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/Gum/coloredrectangle/ColoredRectangle.html) with 50 **Absolute** Width:
The following shows a child [ColoredRectangle](../coloredrectangle.md) with 50 **Absolute** Width:

![Rectangle with an absolute width of 50](<../../../.gitbook/assets/11_05 35 01.png>)

### Relative to Container

The following image shows a child [ColoredRectangle](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/Gum/coloredrectangle/ColoredRectangle.html) with -10 **RelativeToContainer** Width, so it sizes itself 10 pixels less wide than its parent.
The following image shows a child ColoredRectangle with -10 **RelativeToContainer** Width, so it sizes itself 10 pixels less wide than its parent.

![Rectangle using a Relative to Container width value of -10](<../../../.gitbook/assets/11_05 36 16.png>)

Expand All @@ -24,7 +24,7 @@ Despite the name referring to a "Container", the size is relative to the parent

### Percentage of Container

The following shows a child [ColoredRectangle](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/Gum/coloredrectangle/ColoredRectangle.html) with 100 **Percentage of Container** Width, which means it has 100% of the width of its parent. Note that 100 **Percentage** is the same as 0 **Relative to Container**:
The following shows a child ColoredRectangle with 100 **Percentage of Container** Width, which means it has 100% of the width of its parent. Note that 100 **Percentage** is the same as 0 **Relative to Container**:

![Rectangle using 100% of its container](<../../../.gitbook/assets/02_10 09 01.png>)

Expand All @@ -46,7 +46,7 @@ Despite the name referring to a "Container", the total size available for ratios

### Relative to Children

The following image shows a child [ColoredRectangle](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/Gum/coloredrectangle/ColoredRectangle.html) with 50 **Relative to Children** Width, which means that it is sized 50 pixels wider than is necessary to contain its children. Since the rectangle has no children, this is the same as having 50 **Absolute** Width:
The following image shows a child ColoredRectangle with 50 **Relative to Children** Width, which means that it is sized 50 pixels wider than is necessary to contain its children. Since the rectangle has no children, this is the same as having 50 **Absolute** Width:

![Rectangle with a width of 50 Relative to Children, but since it has no children it is 50 units wide](<../../../.gitbook/assets/11_05 46 44.png>)

Expand Down Expand Up @@ -84,15 +84,15 @@ Setting a Text instance's **Width Units** to **Relative to Children** results in

**Percentage of Other Dimension** adjusts the object's effective width so it remains proportional to the Height value multiplied by the Width value (as a percentage). For example, if a Width value of 200 is entered, then the effective width is 200% (2x) of the height.

The following image shows a child [ColoredRectangle](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/Gum/coloredrectangle/ColoredRectangle.html) with a Width of 200 **Percentage of Other Dimension**. In this image, the **Height** value is 50 units, so the effective width is 100 units:
The following image shows a child ColoredRectangle with a Width of 200 **Percentage of Other Dimension**. In this image, the **Height** value is 50 units, so the effective width is 100 units:

![Rectangle displaying a width 200% of its height](<../../../.gitbook/assets/11_05 55 15.png>)

### Percentage of Source File

The [Sprite](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Sprite/README.md) type has an extra **With Unit** called **Percentage of Source File**, which sets the width of the Sprite according to the file that it is displaying. This is the default **Width Unit** for Sprites.

The following image shows a child [Sprite](https://github.com/vchelaru/Gum/tree/8c293a405185cca0e819b810220de684b436daf9/docs/Gum%20Elements/General%20Properties/Sprite/README.md) with 200 **Percentage of Source File** Width, which means it draws two times as wide as its source image:
The following image shows a child [Sprite](../sprite/) with 200 **Percentage of Source File** Width, which means it draws two times as wide as its source image:

![Sprite using 200 Percentage of File width](<../../../.gitbook/assets/11_05 58 09.png>)

Expand Down
Loading

0 comments on commit 0c60cf0

Please sign in to comment.