Changeset 131


Ignore:
Timestamp:
Jul 15, 2017, 4:14:21 AM (15 months ago)
Author:
drazed
Message:

more trimming/scaling/font changes, base-font-size setting and my-capship support

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lists/Controller.lua

    r123 r131  
    377377                local iuploc = iup.label {title = "", font = targetless.var.font }
    378378                iuploc.title = " "..location
    379                 iuploc.size = ""..(80 + ((targetless.var.fontscale*100)) - 40)
     379                iuploc.size = ""..(88 + ((targetless.var.fontscale*100)) - 40)
    380380
    381381                -- ship is not located in this sector, lets build a custom iup for it
  • lists/List.lua

    r98 r131  
    4040            if(self.offset+i > targetless.var.listmax) then return iuplist end
    4141            local itemlabel
    42             local numlabel = iup.label {title = "" .. self.offset+i, fgcolor="150 150 150", font = targetless.var.font, size=30, alignment="ACENTER" }
     42            local numlabel = iup.label {title = "" .. self.offset+i, fgcolor="150 150 150", font = targetless.var.font, size=40, alignment="ACENTER" }
    4343            if(v.hostile) then
    4444                numlabel.fgcolor = "155 32 32"
  • lists/Ship.lua

    r121 r131  
    106106            end
    107107        elseif(tag == "<health>") then
    108             local hsize = 6
    109             local ssize = 3
     108            local hsize = 8
     109            local ssize = 6
    110110            if self.font ~= targetless.var.font then
    111                 ssize = 6
    112                 hsize = 12 
     111                ssize = 8
     112                hsize = 12
    113113            end
    114114            local iupbar = iup.stationprogressbar{visible=((self.health>=0) and "YES" or "NO"), active="NO",size="x"..hsize,expand="HORIZONTAL",title=""}
     
    165165            local distance = tostring(self.distance).."m"
    166166            local capname = string.sub(self.name, 3, string.len(self.name))
    167             local size = ""..(80 + ((targetless.var.fontscale*100)) - 40)
     167            local size = ""..(88 + ((targetless.var.fontscale*160)) - 80)
    168168            if self.distance == 0 and targetless.var.mycaps[capname] ~= nil then
    169169                distance = AbbrLocationStr(targetless.var.mycaps[capname].sectorid)
     
    384384        return iuplabel
    385385    else
    386         local standbar = iup.stationprogressbar{visible="YES",active="NO",size="16x4",title=""}
     386        local standbar = iup.stationprogressbar{visible="YES",active="NO",size="32x8",title=""}
    387387        standbar.minvalue = -100
    388388        standbar.maxvalue = 65535
     
    390390        standbar.lowercolor = "255 255 255 128 *"
    391391        standbar.value = stand
    392         local factbar = iup.stationprogressbar{visible="YES",active="NO",size="16x3",title=""}
     392        local factbar = iup.stationprogressbar{visible="YES",active="NO",size="32x6",title=""}
    393393        factbar.minvalue = 0
    394394        factbar.maxvalue = 100
  • ui/options_ui.lua

    r126 r131  
    2222targetless.ui.options.element.slist = iup.list { "distance", "health", "faction"; dropdown="YES" }
    2323targetless.ui.options.element.flist = iup.list { "smile","wheel","bar"; dropdown="YES" }
     24targetless.ui.options.element.basefontsize = iup.text { value = "" .. targetless.var.basefontsize, size = "100x" }
    2425targetless.ui.options.element.maxlsize = iup.text { value = "" .. targetless.var.listmax, size = "100x" }
    2526targetless.ui.options.element.autopin = {}
     
    190191    scrollbar="HORIZONTAL", size="300x", border="YES",
    191192    expand="NO",
    192     xmin = 50, xmax=100, dx=10, posx=0,
     193    xmin = 50, xmax=150, dx=10, posx=0,
    193194    scroll_cb=statechangefunc,
    194195    active="YES",
     
    198199    iup.hbox
    199200    {
    200         iup.label{title="\127ddddddFont Size:\127o",expand="HORIZONTAL"},
     201        iup.label{title="\127ddddddScale:\127o",expand="HORIZONTAL"},
    201202        iup.fill {},
    202203        targetless.ui.options.element.fontslider,
     204    },
     205    iup.fill{size="30"},
     206    iup.hbox
     207    {
     208        iup.label { title = "\127ddddddBase font size:\127o", expand = "HORIZONTAL" },
     209        iup.fill {},
     210        targetless.ui.options.element.basefontsize,
    203211    },
    204212    iup.fill{size="30"},
     
    310318    else targetless.ui.options.element.slist.value = 3 end
    311319
     320    if targetless.var.basefontsize == 0 then
     321        if gkinterface.IsTouchModeEnabled() then
     322            targetless.var.basefontsize = 20
     323        else
     324            targetless.var.basefontsize = 11
     325        end
     326    end
     327    targetless.ui.options.element.basefontsize.value = ""..targetless.var.basefontsize
     328
    312329    if(targetless.var.faction == "smile") then
    313330        targetless.ui.options.element.flist.value = 1
     
    351368    targetless.var.fontscale = tonumber(targetless.ui.options.element.fontslider.posx)/100
    352369    gkini.WriteInt("targetless", "fontscale", targetless.var.fontscale*100)
     370
     371    targetless.var.basefontsize = tonumber(targetless.ui.options.element.basefontsize.value)
     372    gkini.WriteInt("targetless", "basefontsize", targetless.var.basefontsize)
    353373
    354374    -- need to recalculate the font and trim data
  • var.lua

    r130 r131  
    1111targetless.var.noteoffset = 741937
    1212targetless.var.fontscale = gkini.ReadInt("targetless", "fontscale", 50)/100
     13targetless.var.basefontsize = gkini.ReadInt("targetless", "basefontsize", 0)
    1314targetless.var.res = gkinterface.GetXResolution()
    1415
    15 -- need to initialize these outside the funciton for some reason or mobile breaks?
     16-- calculate the trim size for this device/setting/etc, this is used to trim targetless
     17-- ship/name values to fit at the given font/resolution setting
    1618function targetless.var.trimcalc()
    1719    targetless.var.trim = math.ceil((targetless.var.res/4 - 88)/4)/(targetless.var.fontscale+1)
     
    2123
    2224-- calculate the font size for this device/setting/etc
    23 -- called immediately to initialize the funt
    2425function targetless.var.fontcalc()
    25     if gkinterface.IsTouchModeEnabled() then
     26    -- if set in config use that, otherwise default to 11/20 for pc/mobile respectively
     27    if targetless.var.basefontsize > 0 then
     28        targetless.var.font = targetless.var.basefontsize*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
     29    elseif gkinterface.IsTouchModeEnabled() then
    2630        -- mobile devices have weird/reduced fonts, upscale them here
    27         targetless.var.font = 20*(gkinterface.GetYResolution()/600)*targetless.var.fontscale
     31        targetless.var.font = 20*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
    2832    else
    29         targetless.var.font = 11*(gkinterface.GetYResolution()/600)*targetless.var.fontscale
     33        targetless.var.font = 11*(gkinterface.GetXResolution()/1000)*targetless.var.fontscale
    3034    end
    3135end
Note: See TracChangeset for help on using the changeset viewer.