Wargus / stratagus

The Stratagus strategy game engine
GNU General Public License v2.0
626 stars 119 forks source link

Define info_panel_y multiple times. #28

Closed timfel closed 8 years ago

timfel commented 8 years ago

In scripts/ui.lua there is a line:

local info_panel_y = 160

I'd like to do something like the following:

if ((Video.Width == 800) and (Video.Height == 480)) then local info_panel_y = 160 else local info_panel_y = Video.Height - 136 - 24 - 16 end

However, this results in a crash. Is there a way to get this to work?


Imported from Launchpad using lp2gh.

timfel commented 8 years ago

(by joris-dauphin) local and block in lua: http://www.lua.org/pil/4.2.html

You should try (untested). -- 8< -- local info_panel_y if ((Video.Width == 800) and (Video.Height == 480)) then info_panel_y = 160 else info_panel_y = Video.Height - 136 - 24 - 16 end -- >8 --

timfel commented 8 years ago

(by erstmap) Fantastic, that did the trick!

timfel commented 8 years ago

(by dinky-dye-aussie) I was thinking about this code you're on about Kyran. Made me wonder if in fact I could make interface for the higher resolutions that are a bit chunkier and fill up a bit more space on screen, so we could have higher resolution interface pieces.

When you think about it, the wargus interface at anything above say, 1280 wide, could do with a bit of beefing up, to support bigger set pieces and bigger buttons ... it would be great to have higher resolution fonts. I have seen that Warwind game on the forums, and all of the interfaces look amazing, and they use a bit higher resolution fonts.

It's something to think about, but if that was the case, would I be able to use the same sort of code you have used here, to make it so the higher resolutions use the higher resolution set pieces?

timfel commented 8 years ago

(by erstmap) Yes.