Post #1 · Posted at 2014-09-27 08:23:59pm 9.4 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Im trying to make a color system for my Theme METRO QUAD... I have tried to learn from Simplicity Theme and Simply Love but I cannt make it works...
------------------------------------------------------------
For Example
On my ScreenTitleMenu background I have this:
------------------------------------------------------------
local t = Def.ActorFrame {};
t[#t+1] = Def.Quad {
BeginCommand=cmd(Fullscreen);
InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color(theme_color));
};
return t;
------------------------------------------------------------
In my 02 ThemePref.lua script, if I write in a line:
theme_color = "0,0,255,1" ;
The Def.Quad from the ScreenTitleMenu will get the Blue color. At that moment everything works fine. On my 02 ThemePref.lua script I write this:
local Prefs =
{
ColorPref =
{
Default = 1,
Choices = { "Blue", "Red" },
Values = { 1, 2 }
},
}
------------------------------------------------------------
That will write the line ColorPref=1 on the file ThemePrefs inside the Save folder.
Now, the thing I want to do is, How I can change the value of "theme_color" depending of the value from the preference ColorPref? I have tried a lot of things but nothing works. If I write on the script theme_color = "0,0,255,1" it will show the color Blue, but I cannt make that with a determinate preference that value changes.
Im not sure if I explained myself correct. I hope that someone can help me or maybe tell me a "more correct" way to implemente a Select Color for my Theme.
Thanks
------------------------------------------------------------
For Example
On my ScreenTitleMenu background I have this:
------------------------------------------------------------
local t = Def.ActorFrame {};
t[#t+1] = Def.Quad {
BeginCommand=cmd(Fullscreen);
InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,color(theme_color));
};
return t;
------------------------------------------------------------
In my 02 ThemePref.lua script, if I write in a line:
theme_color = "0,0,255,1" ;
The Def.Quad from the ScreenTitleMenu will get the Blue color. At that moment everything works fine. On my 02 ThemePref.lua script I write this:
local Prefs =
{
ColorPref =
{
Default = 1,
Choices = { "Blue", "Red" },
Values = { 1, 2 }
},
}
------------------------------------------------------------
That will write the line ColorPref=1 on the file ThemePrefs inside the Save folder.
Now, the thing I want to do is, How I can change the value of "theme_color" depending of the value from the preference ColorPref? I have tried a lot of things but nothing works. If I write on the script theme_color = "0,0,255,1" it will show the color Blue, but I cannt make that with a determinate preference that value changes.
Im not sure if I explained myself correct. I hope that someone can help me or maybe tell me a "more correct" way to implemente a Select Color for my Theme.
Thanks
Post #2 · Posted at 2014-09-30 09:41:19am 9.4 years ago
Perhaps the part you are missing is ThemePrefs.Get()
Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.
local t = Def.ActorFrame {}
t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}
return t
t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}
return t
Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.
local Prefs =
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}
Post #3 · Posted at 2014-10-01 08:41:35pm 9.4 years ago
Th3_Ov3rHell_3XoduZ | |
---|---|
Member | |
313 Posts | |
Reg. 2012-09-13 | |
"ITG, The Best Dance Machine!" |
Quote: dbk2
Perhaps the part you are missing is ThemePrefs.Get()
Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.
local t = Def.ActorFrame {}
t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}
return t
t[#t+1] = Def.Quad {
InitCommand=cmd(FullScreen; diffuse,color( ThemePrefs.Get("ColorPref")) ),
OnCommand=cmd(Center),
}
return t
Choices contains the text that appears in the ThemePrefRow(); Values contains the information that your code will use when you call ThemePrefs.Get() from some other part of the theme.
local Prefs =
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}
{
ColorPref =
{
Default = "#0000FF",
Choices = { "Blue", "Red" },
Values = { "#0000FF", "#FF0000" }
},
}
Well... it was something so easy... XD, Thanks U Again, now it works perfectly!!