Relic recently introduced UI Control, which allows modders to create custom UI in SCAR. While working on the custom UI for our mod, Fortress Europe, I came up with an API that made using the UI Control much faster and simpler. I decided to polish it a little bit and release it publicly, for others to benefit from.
It is based on Object Oriented Programming, so it is very versatile. You can create sub classes that inherit from my classes, if you would like. This will allow you to create many different kinds of elements for your custom UI.
The Documentation is a work-in-progress, and I am open to Pull Requests on GitHub.
https://github.com/eliw00d/UIControlAPI
Here is a brief overview of the UI Control API. I will make a more in-depth video at some point.
[SCAR] UI Control API
22 Aug 2015, 17:26 PM
#1
Posts: 756 | Subs: 8
22 Aug 2015, 23:38 PM
#2
Posts: 318
To use localised strings your mod needs, a burn folder containing a "language".ucs
Example localised strings for english.ucs
To references a localised string replace the string whit "$uniqueModID:lineInLocaleLanguageFile".
The example below references the third line/string in the local "language".ucs.
Example localised strings for english.ucs
1 Incendiary Cluster Bomb
2 IncendiaryClusterBomb
3 +%1AMOUNT%:MP\n +%2AMOUNT%:MU\n +%3AMOUNT%:FU
To references a localised string replace the string whit "$uniqueModID:lineInLocaleLanguageFile".
The example below references the third line/string in the local "language".ucs.
g_textString = "$3106b71c884f41eaa8434de9c91bf9cc:3"
23 Aug 2015, 00:04 AM
#3
Posts: 756 | Subs: 8
I did not know it would work with a string, thanks!
23 Aug 2015, 18:18 PM
#4
Posts: 756 | Subs: 8
Turns out the Relic functions do the type checking for you, so you can pass the setText functions an Integer or a String with the following formats:
Integer
<LocStringID>
String
"$<ModID>:<LocStringID>"
"$<LocStringID>"
I have updated the code as a result.
Integer
<LocStringID>
String
"$<ModID>:<LocStringID>"
"$<LocStringID>"
I have updated the code as a result.
23 Aug 2015, 20:44 PM
#5
Posts: 756 | Subs: 8
I have added a Wiki:
https://github.com/eliw00d/UIControlAPI/wiki
Detailed descriptions for methods coming soon, but it should get you started.
https://github.com/eliw00d/UIControlAPI/wiki
Detailed descriptions for methods coming soon, but it should get you started.
3 Sep 2015, 21:05 PM
#6
Posts: 756 | Subs: 8
Added a temporary fix to the Label class's setFontSize method, which should help with Labels getting offset downwards, leading to cut off. Set size and location first, and font size last. Height should be 1:1 with the font size for this to work.
An example:
Let me know if there are any issues. Otherwise, let's hope that Relic fixes the issue!
An example:
Code
label = Label("Label");
label.setSize(128, 16);
label.setLocation(8, 8);
label.setFontSize(label.getHeight() or 16);
Let me know if there are any issues. Otherwise, let's hope that Relic fixes the issue!
18 Nov 2015, 16:52 PM
#7
Posts: 756 | Subs: 8
I have just uploaded Version 2.0, which adds a new Class function and changes the syntax of method calls. I also cleaned up the code quite a bit, which should improve performance and efficiency.
An updated example:
The change from . to : is due to the methods hiding the self variable. For those not familiar with this syntax:
is the same as
So, you should only have to update your own code to reflect the change in syntax, the rest should be the same.
Please let me know if you have any questions or concerns. Thanks and enjoy!
An updated example:
Code
label = Label("Label");
label:setSize(128, 16);
label:setLocation(8, 8);
label:setFontSize(label.getHeight() or 16);
The change from . to : is due to the methods hiding the self variable. For those not familiar with this syntax:
Code
function Label:setSize(width, height)
is the same as
Code
function Label.setSize(self, width, height)
So, you should only have to update your own code to reflect the change in syntax, the rest should be the same.
Please let me know if you have any questions or concerns. Thanks and enjoy!
PAGES (1)
1 user is browsing this thread:
1 guest
Livestreams
22 | |||||
8 | |||||
3 | |||||
2 | |||||
2 | |||||
1 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.831222.789+37
- 2.34957.860+14
- 3.1109614.644+10
- 4.608220.734+2
- 5.276108.719+27
- 6.306114.729+2
- 7.916405.693-2
- 8.722440.621+4
- 9.261137.656+2
- 10.1041674.607-2
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
9
Download
1235
Board Info
843 users are online:
843 guests
0 post in the last 24h
8 posts in the last week
34 posts in the last month
8 posts in the last week
34 posts in the last month
Registered members: 49114
Welcome our newest member, Orji
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, Orji
Most online: 2043 users on 29 Oct 2023, 01:04 AM