-
Notifications
You must be signed in to change notification settings - Fork 286
Implement runtime UI workflow and editor integration #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Gopmyc
wants to merge
37
commits into
Overload-Technologies:main
Choose a base branch
from
Gopmyc:631
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
4656cbd
chore: ignore issue 631 local artifacts
Gopmyc 1106b27
feat(font): add runtime font resources
Gopmyc 1120e5b
feat(ui): add canvas component
Gopmyc 958ee56
feat(ui): add 2d transform component
Gopmyc 3945563
feat(ui): add image component and shader
Gopmyc 9c03605
feat(ui): add text component and shader
Gopmyc dd68d8c
feat(ui): add clay-backed layout group
Gopmyc d3a09ab
feat(ui): register components with ECS and inspector
Gopmyc b1c3e9f
feat(lua): expose UI components
Gopmyc 5bb1b31
feat(rendering): compose UI drawables in scene renderer
Gopmyc ded6032
feat(editor): add UI viewport toggle
Gopmyc 2c56727
feat(editor): draw UI debug bounds
Gopmyc 523cbc5
feat(editor): add UI actor creation shortcuts
Gopmyc a9288d3
refactor(font): use freetype for UI font atlases
Gopmyc bfc575e
feat(ui): add 2d size and layout child-size controls
Gopmyc 1c4eb19
fix(ui): apply controlled child size in layout groups
Gopmyc 1844468
feat(ui): add dedicated horizontal and vertical layout components
Gopmyc c01ec14
feat(ui): add stretch anchors and update lua ui bindings
Gopmyc 8109762
feat(font): add embedded material support
Gopmyc adbcb4d
refactor(ui): reuse font embedded material in text component
Gopmyc dc4457e
fix(editor): scope UI toggle to scene view screen-space mode
Gopmyc 13f5b93
chore: remove local issue 631 ignore artifacts
Gopmyc bb6f099
fix(editor): mark GameView methods as override
Gopmyc 6432d99
refactor(ui): reuse CTransform rotation and scale in Transform2D
Gopmyc ffe4516
fix(ui): use render size for constant-pixel canvas anchors
Gopmyc 30b03c1
build(clay): package clay as standalone dependency
Gopmyc d354331
feat(font): support per-size atlas and embedded material variants
Gopmyc 7afe259
feat(editor): add font reload action in asset browser
Gopmyc 9132476
feat(ui): add multiline support to InputText widget
Gopmyc fa117a5
fix(ui): rebuild text meshes with requested font pixel size
Gopmyc c9b8921
feat(ui): expose layout child-size controls and layout lua docs
Gopmyc abe9465
feat(ui): add canvas match modes and pivot-aware transform2d rendering
Gopmyc aae8a0c
feat(editor): adapt gizmos and debug bounds for canvas-space UI
Gopmyc 27ed417
fix(ui): align canvas sizing and component inspector behavior
Gopmyc c426974
fix(editor): sync ui gizmo render and picking transforms
Gopmyc e16bc89
fix(font): support larger dynamic atlas variants
Gopmyc b2a5409
fix(ui): defer widget/plugin invalidation during callbacks
Gopmyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| zlib/libpng license | ||
|
|
||
| Copyright (c) 2024 Nic Barker | ||
|
|
||
| This software is provided 'as-is', without any express or implied warranty. | ||
| In no event will the authors be held liable for any damages arising from the | ||
| use of this software. | ||
|
|
||
| Permission is granted to anyone to use this software for any purpose, | ||
| including commercial applications, and to alter it and redistribute it | ||
| freely, subject to the following restrictions: | ||
|
|
||
| 1. The origin of this software must not be misrepresented; you must not | ||
| claim that you wrote the original software. If you use this software in a | ||
| product, an acknowledgment in the product documentation would be | ||
| appreciated but is not required. | ||
|
|
||
| 2. Altered source versions must be plainly marked as such, and must not | ||
| be misrepresented as being the original software. | ||
|
|
||
| 3. This notice may not be removed or altered from any source | ||
| distribution. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| project "clay" | ||
| kind "StaticLib" | ||
| language "C" | ||
| cdialect "C17" | ||
| targetdir (outputdir .. "%{cfg.buildcfg}/%{prj.name}") | ||
| objdir (objoutdir .. "%{cfg.buildcfg}/%{prj.name}") | ||
| warnings "Off" | ||
|
|
||
| files { | ||
| "include/**.h", | ||
| "src/**.c", | ||
| "**.lua" | ||
| } | ||
|
|
||
| includedirs { | ||
| "include" | ||
| } | ||
|
|
||
| filter { "configurations:Debug" } | ||
| defines { "DEBUG", "_DEBUG" } | ||
| runtime "Debug" | ||
| symbols "On" | ||
|
|
||
| filter { "configurations:Release or configurations:Publish" } | ||
| defines { "NDEBUG" } | ||
| runtime "Release" | ||
| optimize "On" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /** | ||
| * @project: Overload | ||
| * @author: Overload Tech. | ||
| * @licence: MIT | ||
| */ | ||
|
|
||
| #define CLAY_IMPLEMENTATION | ||
| #include <clay.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| ---@meta | ||
|
|
||
| --- Defines how a Canvas scales UI elements | ||
| ---@enum CanvasScalerMode | ||
| CanvasScalerMode = { | ||
| CONSTANT_PIXEL_SIZE = 0, | ||
| SCALE_WITH_SCREEN_SIZE = 1 | ||
| } | ||
|
|
||
| ---@enum CanvasScreenMatchMode | ||
| CanvasScreenMatchMode = { | ||
| MATCH_WIDTH_OR_HEIGHT = 0, | ||
| EXPAND = 1, | ||
| SHRINK = 2 | ||
| } | ||
|
|
||
| --- Represents a root canvas for in-game user interface elements | ||
| ---@class Canvas : Component | ||
| Canvas = {} | ||
|
|
||
| --- Returns the actor that owns this component | ||
| ---@return Actor | ||
| function Canvas:GetOwner() end | ||
|
|
||
| --- Returns the reference resolution used by the canvas | ||
| ---@return Vector2 | ||
| function Canvas:GetReferenceResolution() end | ||
|
|
||
| --- Defines the reference resolution used by the canvas | ||
| ---@param referenceResolution Vector2 | ||
| function Canvas:SetReferenceResolution(referenceResolution) end | ||
|
|
||
| --- Returns the canvas scale factor | ||
| ---@return number | ||
| function Canvas:GetScaleFactor() end | ||
|
|
||
| --- Defines the canvas scale factor | ||
| ---@param scaleFactor number | ||
| function Canvas:SetScaleFactor(scaleFactor) end | ||
|
|
||
| --- Returns the number of UI pixels represented by one world unit | ||
| ---@return number | ||
| function Canvas:GetPixelsPerUnit() end | ||
|
|
||
| --- Defines the number of UI pixels represented by one world unit | ||
| ---@param pixelsPerUnit number | ||
| function Canvas:SetPixelsPerUnit(pixelsPerUnit) end | ||
|
|
||
| --- Returns the canvas scaler mode | ||
| ---@return CanvasScalerMode | ||
| function Canvas:GetScalerMode() end | ||
|
|
||
| --- Defines the canvas scaler mode | ||
| ---@param scalerMode CanvasScalerMode | ||
| function Canvas:SetScalerMode(scalerMode) end | ||
|
|
||
| --- Returns the screen match mode used with SCALE_WITH_SCREEN_SIZE | ||
| ---@return CanvasScreenMatchMode | ||
| function Canvas:GetScreenMatchMode() end | ||
|
|
||
| --- Defines the screen match mode used with SCALE_WITH_SCREEN_SIZE | ||
| ---@param screenMatchMode CanvasScreenMatchMode | ||
| function Canvas:SetScreenMatchMode(screenMatchMode) end | ||
|
|
||
| --- Returns the match width/height factor in range [0, 1] | ||
| ---@return number | ||
| function Canvas:GetMatchWidthOrHeight() end | ||
|
|
||
| --- Defines the match width/height factor in range [0, 1] | ||
| ---@param value number | ||
| function Canvas:SetMatchWidthOrHeight(value) end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ---@meta | ||
|
|
||
| --- Arranges direct user interface children horizontally | ||
| ---@class HorizontalLayout : LayoutGroup | ||
| HorizontalLayout = {} | ||
|
|
||
| --- Returns the actor that owns this component | ||
| ---@return Actor | ||
| function HorizontalLayout:GetOwner() end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ---@meta | ||
|
|
||
| --- Represents a renderable user interface image | ||
| ---@class Image : Component | ||
| Image = {} | ||
|
|
||
| --- Returns the actor that owns this component | ||
| ---@return Actor | ||
| function Image:GetOwner() end | ||
|
|
||
| --- Returns the texture rendered by the image | ||
| ---@return Texture|nil | ||
| function Image:GetTexture() end | ||
|
|
||
| --- Defines the texture rendered by the image | ||
| ---@param texture Texture|nil | ||
| function Image:SetTexture(texture) end | ||
|
|
||
| --- Returns the image size | ||
| ---@return Vector2 | ||
| function Image:GetSize() end | ||
|
|
||
| --- Defines the image size | ||
| ---@param size Vector2 | ||
| function Image:SetSize(size) end | ||
|
|
||
| --- Returns the image tint | ||
| ---@return Vector4 | ||
| function Image:GetTint() end | ||
|
|
||
| --- Defines the image tint | ||
| ---@param tint Vector4 | ||
| function Image:SetTint(tint) end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| ---@meta | ||
|
|
||
| --- Defines how a LayoutGroup arranges direct UI children | ||
| ---@enum LayoutDirection | ||
| LayoutDirection = { | ||
| HORIZONTAL = 0, | ||
| VERTICAL = 1 | ||
| } | ||
|
|
||
| ---@enum LayoutHorizontalAlignment | ||
| LayoutHorizontalAlignment = { | ||
| LEFT = 0, | ||
| CENTER = 1, | ||
| RIGHT = 2 | ||
| } | ||
|
|
||
| ---@enum LayoutVerticalAlignment | ||
| LayoutVerticalAlignment = { | ||
| TOP = 0, | ||
| CENTER = 1, | ||
| BOTTOM = 2 | ||
| } | ||
|
|
||
| --- Arranges direct user interface children along an axis | ||
| ---@class LayoutGroup : Component | ||
| LayoutGroup = {} | ||
|
|
||
| --- Returns the actor that owns this component | ||
| ---@return Actor | ||
| function LayoutGroup:GetOwner() end | ||
|
|
||
| --- Returns the layout direction | ||
| ---@return LayoutDirection | ||
| function LayoutGroup:GetDirection() end | ||
|
|
||
| --- Defines the layout direction | ||
| ---@param direction LayoutDirection | ||
| function LayoutGroup:SetDirection(direction) end | ||
|
|
||
| --- Returns the spacing between children | ||
| ---@return number | ||
| function LayoutGroup:GetSpacing() end | ||
|
|
||
| --- Defines the non-negative spacing between children | ||
| ---@param spacing number | ||
| function LayoutGroup:SetSpacing(spacing) end | ||
|
|
||
| --- Returns the minimum layout container size | ||
| ---@return Vector2 | ||
| function LayoutGroup:GetSize() end | ||
|
|
||
| --- Defines the minimum layout container size | ||
| ---@param size Vector2 | ||
| function LayoutGroup:SetSize(size) end | ||
|
|
||
| --- Returns the layout padding as left, right, top, bottom | ||
| ---@return Vector4 | ||
| function LayoutGroup:GetPadding() end | ||
|
|
||
| --- Defines the layout padding as left, right, top, bottom | ||
| ---@param padding Vector4 | ||
| function LayoutGroup:SetPadding(padding) end | ||
|
|
||
| --- Returns the horizontal children alignment | ||
| ---@return LayoutHorizontalAlignment | ||
| function LayoutGroup:GetHorizontalAlignment() end | ||
|
|
||
| --- Defines the horizontal children alignment | ||
| ---@param alignment LayoutHorizontalAlignment | ||
| function LayoutGroup:SetHorizontalAlignment(alignment) end | ||
|
|
||
| --- Returns the vertical children alignment | ||
| ---@return LayoutVerticalAlignment | ||
| function LayoutGroup:GetVerticalAlignment() end | ||
|
|
||
| --- Defines the vertical children alignment | ||
| ---@param alignment LayoutVerticalAlignment | ||
| function LayoutGroup:SetVerticalAlignment(alignment) end | ||
|
|
||
| --- Returns whether the layout controls children width | ||
| ---@return boolean | ||
| function LayoutGroup:GetControlChildrenWidth() end | ||
|
|
||
| --- Defines whether the layout controls children width | ||
| ---@param value boolean | ||
| function LayoutGroup:SetControlChildrenWidth(value) end | ||
|
|
||
| --- Returns whether the layout controls children height | ||
| ---@return boolean | ||
| function LayoutGroup:GetControlChildrenHeight() end | ||
|
|
||
| --- Defines whether the layout controls children height | ||
| ---@param value boolean | ||
| function LayoutGroup:SetControlChildrenHeight(value) end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| ---@meta | ||
|
|
||
| ---@enum TextHorizontalAlignment | ||
| TextHorizontalAlignment = { | ||
| LEFT = 0, | ||
| CENTER = 1, | ||
| RIGHT = 2 | ||
| } | ||
|
|
||
| ---@enum TextVerticalAlignment | ||
| TextVerticalAlignment = { | ||
| TOP = 0, | ||
| CENTER = 1, | ||
| BOTTOM = 2 | ||
| } | ||
|
|
||
| --- Represents a renderable user interface text | ||
| ---@class Text : Component | ||
| Text = {} | ||
|
|
||
| --- Returns the actor that owns this component | ||
| ---@return Actor | ||
| function Text:GetOwner() end | ||
|
|
||
| --- Returns the text content | ||
| ---@return string | ||
| function Text:GetText() end | ||
|
|
||
| --- Defines the text content | ||
| ---@param text string | ||
| function Text:SetText(text) end | ||
|
|
||
| --- Returns the font resource path | ||
| ---@return string | ||
| function Text:GetFontPath() end | ||
|
|
||
| --- Defines the font resource path | ||
| ---@param fontPath string | ||
| function Text:SetFontPath(fontPath) end | ||
|
|
||
| --- Returns the font size in canvas pixels | ||
| ---@return number | ||
| function Text:GetFontSize() end | ||
|
|
||
| --- Defines the font size in canvas pixels | ||
| ---@param fontSize number | ||
| function Text:SetFontSize(fontSize) end | ||
|
|
||
| --- Returns the text color | ||
| ---@return Vector4 | ||
| function Text:GetColor() end | ||
|
|
||
| --- Defines the text color | ||
| ---@param color Vector4 | ||
| function Text:SetColor(color) end | ||
|
|
||
| --- Returns the text extents in canvas pixels | ||
| ---@return Vector2 | ||
| function Text:GetExtents() end | ||
|
|
||
| --- Defines the text extents in canvas pixels | ||
| ---@param extents Vector2 | ||
| function Text:SetExtents(extents) end | ||
|
|
||
| --- Returns the horizontal text alignment | ||
| ---@return TextHorizontalAlignment | ||
| function Text:GetHorizontalAlignment() end | ||
|
|
||
| --- Defines the horizontal text alignment | ||
| ---@param alignment TextHorizontalAlignment | ||
| function Text:SetHorizontalAlignment(alignment) end | ||
|
|
||
| --- Returns the vertical text alignment | ||
| ---@return TextVerticalAlignment | ||
| function Text:GetVerticalAlignment() end | ||
|
|
||
| --- Defines the vertical text alignment | ||
| ---@param alignment TextVerticalAlignment | ||
| function Text:SetVerticalAlignment(alignment) end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.