From 45176a2d577b0818a1589a734d5a3f37ef0b96cd Mon Sep 17 00:00:00 2001 From: Marrub Date: Sun, 30 Dec 2018 05:08:09 -0500 Subject: [PATCH] DrawTexture and VirtualToRealCoords --- api-drawing-Screen.md | 52 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/api-drawing-Screen.md b/api-drawing-Screen.md index bdf134f..f875820 100644 --- a/api-drawing-Screen.md +++ b/api-drawing-Screen.md @@ -45,7 +45,55 @@ struct Screen - `DrawTexture` - TODO + Draws texture `tex`, possibly animated by the animation ticker if `animate` is `true`, at horizontal position `x` and vertical position `y`. + + Various properties of this drawing process can be changed by passing extra arguments to this function. After all arguments are parsed, the "`CleanMode`" internal variable is used along with the specified virtual width/height to determine how to finally transform positions. `CleanMode` may be one of the following: + + | Name | Description | + | ---- | ----------- | + | `DTA_Clean` | Scales all positions by `Clean*Fac`. See the documentation for those variables for more information. | + | `DTA_CleanNoMove` | Scales the destination width and height by `Clean*Fac`. | + | `DTA_CleanNoMove_1` | Scales the destination width and height by `Clean*Fac_1`. | + | `DTA_Fullscreen` | Sets the X and Y positions to `0`. (Yes, really, this is all it does.) | + | `DTA_HUDRules` | Scales all positions by the current status bar's scaling rules. | + | `DTA_HUDRulesC` | Scales all positions by the current status bar's scaling rules and centers the X position. | + + Here is a list of tags and their respective arguments which may be used: + + | Name | Arguments | Description | + | ---- | --------- | ----------- | + | `DTA_320x200` | `bool use` | Sets `CleanMode` to `DTA_Base` and the virtual width/height to `320`/`200` if `use` is `true`. Note that 320x200 does not scale properly to the screen as it must be 320x240 to do so. | + | `DTA_AlphaChannel` | `bool use` | Does nothing unless `DTA_FillColor` is used and the render style is unspecified, in which case it will set the render style to "shaded" if `use` is `true`. | + | `DTA_Alpha` | `double alpha` | Sets the alpha of the drawn texture to `alpha`. | + | `DTA_Bottom320x200` | `bool use` | Same as `DTA_320x200`, but also enables position transformation as if a call to `VirtualToRealCoords` with `vbottom` to `true`. Note that this is the only way to actually set this, but it may be overridden by following arguments to effectively toggle only this flag. | + | `DTA_CenterBottomOffset` | `bool use` | Same as `DTA_CenterBottomOffset`, but the Y offset is aligned to the bottom instead of the center. | + | `DTA_CenterOffset` | `bool use` | Overrides the texture's X and Y offsets, centering them between the texture's height and width if `use` is `true`. | + | `DTA_CleanNoMove1` | `bool use` | Sets `CleanMode` to `DTA_CleanNoMove1` if `use` is `true`. | + | `DTA_CleanNoMove` | `bool use` | Sets `CleanMode` to `DTA_CleanNoMove` if `use` is `true`. | + | `DTA_Clean` | `bool use` | Sets `CleanMode` to `DTA_Clean` if `use` is `true`. | + | `DTA_ClipBottom`, `DTA_ClipTop` | `int length` | Sets the vertical clipping for the texture. | + | `DTA_ClipLeft`, `DTA_ClipRight` | `int length` | Sets the horizontal clipping for the texture. | + | `DTA_ColorOverlay` | `color cr` | Multiplies `cr` with the texture. Alpha determines the intensity of this overlay. Applied before render styles. | + | `DTA_Color` | `color cr` | Multiplies `cr` with the texture. Applied after render styles change the color. | + | `DTA_Desaturate` | `int amount` | Desaturates the texture by `amount` (range 0-255.) | + | `DTA_DestHeightF`, `DTA_DestWidthF` | `double size` | Same as `DTA_DestHeight`/`DTA_DestWidth`, but with decimal arguments. | + | `DTA_DestHeight`, `DTA_DestWidth` | `int size` | Sets the resulting width or height on screen of the texture and sets `CleanMode` to `DTA_Base`. | + | `DTA_FillColor` | `color cr` | Sets the render style to "stencil" if one is not specified and the fill color to `cr`. | + | `DTA_FlipX`, `DTA_FlipY` | `bool use` | Flips the X or Y position if `use` is `true`. + | `DTA_Fullscreen` | `bool use` | Sets `CleanMode` to `DTA_Fullscreen` and the virtual width and height to the display size of the texture. | + | `DTA_HUDRules` | `int type` | Sets `CleanMode` to `DTA_HUDRulesC` if `type` is `BaseStatusBar.HUD_HorizCenter`, or `DTA_HUDRules` if it is `BaseStatusBar.HUD_Normal`. | + | `DTA_KeepRatio` | `bool on` | Enables aspect ratio correction if `on` is `true`. | + | `DTA_LeftOffsetF`, `DTA_TopOffsetF` | `double ofs` | Same as `DTA_LeftOffset`/`DTA_TopOffsetF`, but with decimal arguments. | + | `DTA_LeftOffset`, `DTA_TopOffset` | `int ofs` | Overrides the texture's X or Y offset. | + | `DTA_LegacyRenderStyle` | `int style` | Overrides the render style. Note that there is also a `DTA_RenderStyle` which cannot be used because the engine does not expose `FRenderStyle` yet. | + | `DTA_Masked` | `bool on` | Turns the texture fully opaque (no alpha mask) if `on` is `false`. Default value is on. | + | `DTA_SrcHeight`, `DTA_SrcWidth` | `int size` | Sets the width or height of the source image. Will cut the texture if lower than the original size. (TODO: I don't know what happens when the size is bigger.) | + | `DTA_SrcX`, `DTA_SrcY` | `int pos` | Sets the X or Y on the source image to start the texture at. (TODO: I'm not sure how the texture handles wrapping.) | + | `DTA_TranslationIndex` | `int index` | Remaps colors in the destination texture with translation table `index`. | + | `DTA_VirtualHeightF`, `DTA_VirtualWidthF` | `double size` | Same as `DTA_VirtualHeight`/`DTA_VirtualWidth`, but with decimal arguments. | + | `DTA_VirtualHeight`, `DTA_VirtualWidth` | `int size` | Sets the virtual width or height to `size`. | + | `DTA_WindowLeftF`, `DTA_WindowRightF` | `double size` | Same as `DTA_WindowLeft`/`DTA_WindowRight`, but with decimal arguments. | + | `DTA_WindowLeft`, `DTA_WindowRight` | `int size` | Crops `size` pixels from the left or right. | - `Clear` @@ -85,7 +133,7 @@ struct Screen - `VirtualToRealCoords` - TODO + Converts virtual coordinates `pos` from virtual coordinate space `vsize` to screen coordinate space `size`, possibly accounting for aspect ratio differences if `handleaspect` is true. If the ratio is 5:4, `vbottom` will account for the higher-than-wide conversion by repositioning vertically. - `ClearClipRect`