-
-
Notifications
You must be signed in to change notification settings - Fork 405
feat: adaptive ui loading #451
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
372673f
feat: WIP start on adaptive UI support
BenDol 79f6762
Resolve crash issues with callLuaField when called in a constructor
BenDol 2dd861b
doc update
BenDol 9fb1df8
wip: initial support for device/os based styling!
BenDol 7f3359e
Style changes and debug logs
BenDol 0deeefd
style fix
BenDol faf8c71
Add apple device setup
BenDol 67d48ea
Merge branch 'main' into feat/adaptive_ui
BenDol 85f39fd
add Logger setLevel/getLevel
BenDol 0c66837
Add supported devices to modules
BenDol 4549344
Minor style change
BenDol 9cbe5b7
Merge branch 'main' into pr/451
mehah 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 @@ | ||
| Button < UIButton | ||
| font: verdana-11px-antialised | ||
| color: #dfdfdfff | ||
| size: 146 63 | ||
| text-offset: 0 0 | ||
| image-source: /images/ui/button | ||
| image-color: #dfdfdf | ||
| image-clip: 0 0 22 23 | ||
| image-border: 3 | ||
| padding: 5 10 5 10 | ||
| opacity: 1.0 | ||
|
|
||
| $hover !disabled: | ||
| image-clip: 0 23 22 23 | ||
|
|
||
| $pressed: | ||
| image-clip: 0 46 22 23 | ||
| text-offset: 1 1 | ||
|
|
||
| $disabled: | ||
| color: #dfdfdf88 | ||
| opacity: 0.8 |
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
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,3 @@ | ||
| EnterGameWindow < MainWindow | ||
| !text: tr('Mobile: Enter Game') | ||
| size: 436 498 |
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 |
|---|---|---|
| @@ -1,28 +1,41 @@ | ||
| local resourceLoaders = { | ||
| ["otui"] = g_ui.importStyle, | ||
| ["otfont"] = g_fonts.importFont, | ||
| ["otps"] = g_particles.importParticle, | ||
| } | ||
|
|
||
| function init() | ||
| local files | ||
| files = g_resources.listDirectoryFiles('/styles') | ||
| for _, file in pairs(files) do | ||
| if g_resources.isFileType(file, 'otui') then | ||
| g_ui.importStyle('/styles/' .. file) | ||
| end | ||
| end | ||
| local device = g_platform.getDevice() | ||
| importResources("styles", "otui", device) | ||
| importResources("fonts", "otfont", device) | ||
| importResources("particles", "otps", device) | ||
|
|
||
| g_mouse.loadCursors('/cursors/cursors') | ||
| end | ||
|
|
||
| files = g_resources.listDirectoryFiles('/fonts') | ||
| for _, file in pairs(files) do | ||
| if g_resources.isFileType(file, 'otfont') then | ||
| g_fonts.importFont('/fonts/' .. file) | ||
| function terminate() | ||
| end | ||
|
|
||
| function importResources(dir, type, device) | ||
| local path = '/'..dir..'/' | ||
| local files = g_resources.listDirectoryFiles(path) | ||
| for _,file in pairs(files) do | ||
| if g_resources.isFileType(file, type) then | ||
| resourceLoaders[type](path .. file) | ||
| end | ||
| end | ||
|
|
||
| files = g_resources.listDirectoryFiles('/particles') | ||
| for _, file in pairs(files) do | ||
| if g_resources.isFileType(file, 'otps') then | ||
| g_particles.importParticle('/particles/' .. file) | ||
| -- try load device specific resources | ||
| if device then | ||
| local devicePath = g_platform.getDeviceShortName(device.type) | ||
| if devicePath ~= "" then | ||
| table.insertall(files, importResources(dir..'/'..devicePath, type)) | ||
| end | ||
| local osPath = g_platform.getOsShortName(device.os) | ||
| if osPath ~= "" then | ||
| table.insertall(files, importResources(dir..'/'..osPath, type)) | ||
| end | ||
| return | ||
| end | ||
|
|
||
| g_mouse.loadCursors('/cursors/cursors') | ||
| end | ||
|
|
||
| function terminate() | ||
| return files | ||
| 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
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
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
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
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
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
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
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
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
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
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
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.