Different Interface when starting on Android OS

  • #1, z marvelWednesday, 10. May 2017, 15:48 hodinky 8 years ago
    Hey guys,
    I want to choose a different main interface, when the game is being started from an android or iOS device. Any idea how to handle this? smile

    Also I think about the best way how to build the interfaces in a max compatible way... so that it works just fine on PC AND Tablet/Smartphone. Is it possible to just scale up inventory items and interfaces? I'm curious what you think about it. What is the best and most efficient way?

    Thomas

    Zabiják klíčů

    599 Posts


  • #2, z afrlmeWednesday, 10. May 2017, 16:21 hodinky 8 years ago
    Not sure about interface bit, but there is a Lua function that allows you to check the current platform the game is being played on. According to the wiki it only supports win & mac, but I'm pretty sure I remember seeing other platforms available before.

    Probably better to create a duplicate of your ved & replace the interfaces for the android/iOS exports. Probably take you a couple of hours to a day to sort out at most.

    Anyway, the Lua function is the getProperty function, which you can find here: https://wiki.visionaire-tracker.net/wiki/GetProperty

    -- example... you could setup a value in the editor to store the results
    if getProperty("platform") == "win" then
     Values["platform"].Int = 1
    elseif  getProperty("platform") == "mac" then
     Values["platform"].Int = 2
    elseif  getProperty("platform") == "linux" then
     Values["platform"].Int = 3
    elseif  getProperty("platform") == "ios" then
     Values["platform"].Int = 4
     elseif  getProperty("platform") == "android" then
     Values["platform"].Int = 5
    end

    Quick note: I don't know if the property values I've used are correctly written or whether or not they exist. You'll have to ask Simon.

    Anyway, as for most compatible interface for both desktop computer & handheld device, I would recommend single command interface a la broken sword. I'm not sure how gestures work... can you do right click with touchscreen device? Anyway, you can always emulate right click by having a mouse event listener & having it create a right click instance on mouse hold or double click or something.

    I'm pretty sure you will figure something out. wink

    Imperátor

    7285 Posts

  • #3, z sebastianWednesday, 10. May 2017, 16:29 hodinky 8 years ago
    When you want a different main interface you need to swap it out . Both interfaces need to be in the same class, but only one /default) should be active for the current character .
    To determine if you are on a specific system you need some Lua script. May you put this in the game startup action:

    local platform = getProperty("platform")

    if platform == "win" or platform == "mac" then
      Values["system_platform"].Int = 0
    elseif platform == "android" or platform == "ios" then 
      Values["system_platform"].Int = 1
    end

    I changed a value here to 0 (desktop system) or 1 (mobile/tablet device) ... maybe you can do them more precisely and have more differentiation if you like

    After the script above runs you can check it via the Visionaire action part and change the interface from the default to the other variant with the "set interface" action part:

    ---

    @ Scaling of Items in inventory: Should also be possible with lua and set its object Scale to >100% (100 is original size). But the inventory slots remain the same so its a bit useless here.
    Scaling of Interfaces completely is not possible as far as i know...


    EDIT: AAARGH Lee was faster XD

    Kapitán

    2346 Posts

  • #4, z stroncisWednesday, 10. May 2017, 16:36 hodinky 8 years ago
    In plain Lua this works:
    local binaryType = package.cpath:match("%p[\\|/]?%p(%a+)")
    
    print("Binary type: " .. binaryType)

    You can output to game screen passing binaryType to drawFont "graphics.drawFont(binarytype, x, y, alpha)" and determine, what it outputs on iOS, Android and Win mobile. I can't check on other platforms, but so far:
    "dll" is Windows
    "so" Linux
    "dylib" MacOS

    Bažant

    42 Posts