Download the latest version from the widget database

Moderator: Moderators
Code: Select all
[f=0000862] Loading: LuaUI/Widgets/gui_windSpeed.lua
[f=0000862] [Font] Error: Failed creating font: Couldn't find font 'luaui/fonts/FreeSansBold.otf'.
[f=0000863] false
[f=0000863] Error in DrawScreen(): [string "LuaUI/Widgets/gui_windSpeed.lua"]:78: attempt to index upvalue 'Myfont' (a nil value)
[f=0000863] Removed widget: Wind Speed
Code: Select all
gl.Text(format('%.1f', wind), iconWidth + 13, 15, MyFontSize)
Code: Select all
function widget:TweakMousePress(mx, my, mButton)
function widget:TweakMouseMove(mx, my, dx, dy, mButton)
Code: Select all
gl.Texture('LuaUI/Images/Windicon.png')
Code: Select all
gl.Texture(false)
Works - I see a windmill :)Niobium wrote:Given someone has problems with the texture, I'd remove the texture options and go with:Code: Select all
gl.Texture('LuaUI/Images/Windicon.png')
I'll fix this, perhaps so it's just 100% green, or maybe set it grey or white or something to represent that it doesn't change?dansan wrote:It has a bug in case of Tundra with min=max wind --> always red.
Not sure if there is a way to fetch a game's max windmill energy usage but I guess it wouldn't be too hard to setup an array for the top 5 games or something with their max windmill energy hard-coded. It'd just require changing if a game changes it.dansan wrote:Not your widgets fault: in BA max. 25 E of a windmill is used, even if wind is stronger. Is there a way to find out such max-settings of a game? Is it possible for a map to change that? IMO the green should be at min(max(map), max(game)).
I did do it this way originally, but changed it when I struggled finding good examples of using other fonts with it. Looks like I don't need to though, silly meNiobium wrote:Theres no need for any font handling whatsoever:Code: Select all
gl.Text(format('%.1f', wind), iconWidth + 13, 15, MyFontSize)
Simple enough!Niobium wrote:Only in tweak mode is easy, just add 'Tweak' to the callins:Code: Select all
function widget:TweakMousePress(mx, my, mButton) function widget:TweakMouseMove(mx, my, dx, dy, mButton)
Alright, I didn't account for how other OSs handle files and directories and such.Niobium wrote:Given someone has problems with the texture, I'd remove the texture options and go with:Code: Select all
gl.Texture('LuaUI/Images/Windicon.png')
AlrightyNiobium wrote:You'll also want to put addRight after you've used the texture, otherwise it stays set and can interfere with other widgets.Code: Select all
gl.Texture(false)
I already thought of that, and was gonna make it a configurable optionvery_bad_soldier wrote: EDIT:
Dunno if its really desired to have it rotating. Might be annoying to have a permanently rotating GUI element, no? Who gave you that shitty idea?
Code: Select all
- No longer includes a font file
- Only moveable in tweak-mode
- Colour is green instead of red on maps where min and max wind are equal
- Blades on the windmill rotate according to the wind percentage
- Is hidden until the game begins
Just been speaking with vbs about this too, I'll see what I can do, thanks!knorke wrote:you read Spring.GetWind and in DrawScreen() which is very often but wind only changes slowly.
So read it in GameFrame() instead and calculate color there too.
If you increase rotation variable in DrawScreen the windmill will spin faster the more FPS you have.
Use Update (dt) instead.
Neither will not make a difference in speed for this widget but for more complex things it might and since you asked for critique
A few people told me they didn't like the fact it could be moved out of tweak mode as they sometimes usually move widgets that have this functionality by accident. I've never had this problem myself, might be due to my huge monitor but it would be nice to know what the majority think should be the default way to move a widget's position.Jools wrote:I think it has become spring standard to allow move of widgets when you press the middle mouse button and drag it. I think that could be a nice option.
Tweak mode screws up ctrl key state.
Your texture dimensions need to be the power of 2. So resize the image (do not scale, resize the "canvas") and then grab the actually needed region by using texture coordinates.Jazcash wrote:Any ideas how to fix this artifacting?
Already fixed before reading this, but thanks anywho!very_bad_soldier wrote:Your texture dimensions need to be the power of 2. So resize the image (do not scale, resize the "canvas") and then grab the actually needed region by using texture coordinates.Jazcash wrote:Any ideas how to fix this artifacting?
Thats at least how I did it.
Now fixed, the blade image just added more white-space around it due to exceeding its size limit when rotating. Thanks to BD for pointing this out, silly I couldn't see it myself :D
Hm I dont get that, it exceeds size limit when rotation?Jazcash wrote:Now fixed, the blade image just added more white-space around it due to exceeding its size limit when rotating.
I don't fully understand it either, which is naughty of me. This is what I think was the issue, or at least, may be related in some way...very_bad_soldier wrote:Hm I dont get that, it exceeds size limit when rotation?Jazcash wrote:Now fixed, the blade image just added more white-space around it due to exceeding its size limit when rotating.
Yep, already on my to-do list as a configurable option!Floris wrote: Maybe change the color change red/green to relative effectiveness comparing with solar power?
It makes it more aperant on which windspeeds/ building winds is more effective to the average or newbie players.