chili questions:
Moderator: Moderators
chili questions:
Drawing lines in chili windows, how do I do them? I need to do lines for a line graph.
How can I specify an alternate texture for a skin element? Say like a chili button, I have the skin's button texture but for this one button, I want to make it different texturally.
How can I specify an alternate texture for a skin element? Say like a chili button, I have the skin's button texture but for this one button, I want to make it different texturally.
Re: chili questions:
@LineGraph
You may want to use a simple Control and write your own DrawControl function.
@per control skin
Either define SkinName (if you want to use a diff one), or just override the skin params. The skin params are what you find in skin.lua, e.g.:this gets appended to all Chili.Buttons, now each instance can override those if they want, e.g.:
You may want to use a simple Control and write your own DrawControl function.
Code: Select all
local graph = {0.1, 0.3, 0.2, 0.4, 0.3, 0.6}
local DrawGraph()
local graph_n = #data
if (graph_n < 2) then return end
for i=1, graph_n do
local ordinate = data[i]
gl.Vertex((i - 1)/(graph_n - 1), ordinate)
end
end
local canvas = Chili.Control:New{
...
DrawControl = function (obj)
local x = obj.x
local y = obj.y
local w = obj.width
local h = obj.height
gl.Color(obj.backgroundColor)
gl.PushMatrix()
gl.Translate(x, y, 0)
gl.Scale(w, h, 1)
gl.BeginEnd(GL.LINES, DrawGraph)
gl.PopMatrix()
end
...
}
Either define SkinName (if you want to use a diff one), or just override the skin params. The skin params are what you find in skin.lua, e.g.:
Code: Select all
skin.button = {
TileImageBK = ":cl:tech_button.png",
TileImageFG = ":cl:empty.png",
tiles = {22, 22, 22, 22}, --// tile widths: left,top,right,bottom
padding = {10, 10, 10, 10},
backgroundColor = {1, 1, 1, 0.7},
DrawControl = DrawButton,
}
Code: Select all
local btn = Chili.Button:New{
...
TileImageBK = MY_PATH .. "/my_button.png",
tiles = {7, 7, 7, 7},
...
}
Re: chili questions:
Code: Select all
....
else
gridchildren[k] = Chili.Button:New{
parent = parentPanel,
TileImageBK = ":cl:button_glow.png",
caption = '',
x = 3+gridXPos,
y = 5+gridYPos,
...
Re: chili questions:
my own chili question...
is it possible to use spring window/screen relative positioning of chili windows? It is very annoying to have to manually reconfigure the whole layout with Ctrl+F11 every time i change spring window size.
is it possible to use spring window/screen relative positioning of chili windows? It is very annoying to have to manually reconfigure the whole layout with Ctrl+F11 every time i change spring window size.
Re: chili questions:
Already answered in chat. Skins get their paths autoexpanded, so when you override them you need to define the full path.smoth wrote:So I tried this but it doesn't pick up the texture in the skin dir. Any idea?
Re: chili questions:
Chili supports relative & absolute constraints.hoijui wrote:my own chili question...
is it possible to use spring window/screen relative positioning of chili windows? It is very annoying to have to manually reconfigure the whole layout with Ctrl+F11 every time i change spring window size.
Re: chili questions:
hmm ok...
i have tried to find a related option in ZK interface options, but there seems to be none. i hope it is clear what i am asking for...
when i place the unit info window into the lower-left corner, i want it to have 100% y and 0% x coordinates (don't know where sure where the origin is in chili, but you know what i mean), so it would always stay in that corner, no matter how i resize the screen. this should be the default (docking status had to be remembered, so that would override the coordinates).
i have tried to find a related option in ZK interface options, but there seems to be none. i hope it is clear what i am asking for...
when i place the unit info window into the lower-left corner, i want it to have 100% y and 0% x coordinates (don't know where sure where the origin is in chili, but you know what i mean), so it would always stay in that corner, no matter how i resize the screen. this should be the default (docking status had to be remembered, so that would override the coordinates).
Re: chili questions:
appearently it is as easy as
x = '50%',
y = '50%',
http://springrts.com/wiki/Lesson_2_:_Dy ... el_content
Also the threads by that sunspot guy might be interessting.
x = '50%',
y = '50%',
http://springrts.com/wiki/Lesson_2_:_Dy ... el_content
Also the threads by that sunspot guy might be interessting.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: chili questions:
It's not a simple fix for ZK because Selections breaks the UI rules and is not properly scalable. Docking would need changing to support it.
Re: chili questions:
yeah still working on that. I cannot figure out how to make the skinhandler vars accessible or call the functions in it. I wish I knew how but I don't understand what you are doing nor can I spend all sunday figuring exactly how chili uses the file.jK wrote:Already answered in chat. Skins get their paths autoexpanded, so when you override them you need to define the full path.smoth wrote:So I tried this but it doesn't pick up the texture in the skin dir. Any idea?
So far I have done this:
Code: Select all
local CHILI_DIRNAME = LUAUI_DIRNAME.."Widgets/chili/"
local skinFolder = CHILI_DIRNAME .. "Skins/"
Re: chili questions:
try
or even better
Code: Select all
local skinFolder = Chili.SkinHandler.defaultSkin.info.dir
Code: Select all
local skinName = "GundamSkinXYZ"
local skinFolder = Chili.SkinHandler.knownSkins[skinName:lower()].info.dir
Re: chili questions:
seems I cannot access Chili. until update() why is that? I know it's old-school but I like to put var declarations and initializations at the top of my source file.
Re: chili questions:
Code: Select all
local Chili
function widget:Initialize()
...
Chili = WG.Chili
...
end
Re: chili questions:
I don't understand this one... selections when in Ctrl+F11 mode?Google_Frog wrote:It's not a simple fix for ZK because Selections breaks the UI rules and is not properly scalable.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: chili questions:
The elements of the unit selections box that appears above the command menu when units are selected do not resize with the box. The minimum size is the default size and also the only usable size.
Re: chili questions:
ahh i see, i see. so far, i was not considering the size of windows to scale aswell, only the position. i guess for some windows, scaling them makes no sense, and for others it would make more sense then not scaling them.