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
25 | |||||
6 | |||||
5 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.655231.739+15
- 2.842223.791+5
- 3.940410.696+6
- 4.35459.857-1
- 5.599234.719+7
- 6.278108.720+29
- 7.307114.729+3
- 8.645.928+5
- 9.10629.785+7
- 10.527.881+18
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
11
Download
1265
Board Info
838 users are online:
1 member and 837 guests
NigelBallsworth
NigelBallsworth
2 posts in the last 24h
10 posts in the last week
28 posts in the last month
10 posts in the last week
28 posts in the last month
Registered members: 50010
Welcome our newest member, yresearcher
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, yresearcher
Most online: 2043 users on 29 Oct 2023, 01:04 AM