Author Topic: Fetch orientation from list  (Read 2247 times)

haynor666

  • Newbie
  • *
  • Posts: 3
    • View Profile
Fetch orientation from list
« on: July 23, 2015, 03:46:18 AM »
I'm trying to build layout that can stretch image according to game aspect orientation ie. stretch on area 256x224 or 224x256. Question is, how I can get this variable from list, how can I use it?
There was similiar problem http://forum.attractmode.org/index.php?topic=209.0 but some horizontal screenshots proportions are lower than 1 for example Knuckle Joe so taking image properties and setting stretch according to aspect ratio is not always the best idea.

EDIT. I miss fe.game_info(Info.Rotation), now figure out how to use it.

EDIT. I gave up, I wrote something like this:


local wi;
local he;

function proportions ( wi , he )
  if ( fe.game_info(Info.Rotation) == 0 )
  {
    wi=256;
    he=192;
  }

  else

  {
    wi=192;
    he=256;
  }


local t = fe.add_artwork( "snap", 16, 16, wi, he );
t.trigger = Transition.EndNavigation;

but fetching wi and he does not work. Attract mode claims that values are null. What I'm getting wrong ?
« Last Edit: July 23, 2015, 05:35:38 AM by haynor666 »

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 391
    • View Profile
Re: Fetch orientation from list
« Reply #1 on: July 23, 2015, 10:16:56 PM »
I don't see where the proportions function you have declared is getting called.  also I think the wi and he parameters are shadowing the "wi" and "he" local variables you have declared, preventing them from ever getting set.  Try getting rid of the "function proportions( wi, he )" line in your code.

haynor666

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Fetch orientation from list
« Reply #2 on: July 23, 2015, 11:13:14 PM »
I'm sorry but I'm poor programist. I tried as You suggested:

local wi;
local he;

  if ( fe.game_info(Info.Rotation) == 0 )
  {
    wi=256;
    he=192;
  }

  else

  {
    wi=192;
    he=256;
  }


local t = fe.add_artwork( "snap", 16, 16, wi, he );
t.trigger = Transition.EndNavigation;

Now attract mode always setting 192x256 even if currently visible game is with orientation 270, not to mention that switching on the fly does not work.

EDIT. Ok, fe.game_info(Info.Rotation) was not integer, new version:

local wi;
local he;

local or = fe.game_info(Info.Rotation);
local orint = or.tointeger();

  if (orint > 0 )
  {
    wi=240;
    he=320;
  }

  else

  {
    wi=320;
    he=240;
  }

local t = fe.add_artwork( "snap", 300, 16, wi, he );
t.trigger = Transition.EndNavigation;

works but still not on the fly, parameters are taken only from first game and that's it :( I suppose I have to loop t.trigger = Transition.EndNavigation;  Is it possible to changing snap area on the fly (variable wight and height attributes) ?
« Last Edit: July 23, 2015, 11:44:21 PM by haynor666 »

slydog43

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Re: Fetch orientation from list
« Reply #3 on: August 27, 2015, 01:19:24 PM »
did you ever get fe.gameinfo to work, I think I'm having the same trouble when trying to get Emulator out of fe.gameinfo