Author Topic: Determining orientation of game?  (Read 2811 times)

justintime

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Determining orientation of game?
« on: October 06, 2024, 03:06:01 PM »
So I am writing my own theme, and I am finding that in order to fine tune the display of the snap/video, I need to have a different skew and pinch depending on whether the video is horizontal or vertical.    I believe I can NOT obtain easily the width/height of the video itself even using the texture_width or texture_height properties.

So, I am thinking if I can obtain the rom/game orientation info then I can put a conditional statement in my code and format the video/snap object accordingly.

Is there a way to do this?  If not, any other workarounds?

Thanks, Im lovig the power of AM, coming from HyperSpin.
« Last Edit: October 06, 2024, 03:31:13 PM by justintime »

zestful

  • Full Member
  • ***
  • Posts: 35
    • View Profile
Re: Determining orientation of game?
« Reply #1 on: October 07, 2024, 01:54:49 PM »
You can thank Oomek for this, it'll render the snap, maintain it's aspect ratio and place a border around it.  You need Attract Mode + and inertia installed

Code: [Select]
local snap = fe.add_artwork( "snap",358, 220, 1200, 480);
snap.preserve_aspect_ratio = true;
snap.zorder = 5;

local flw = fe.layout.width
local flh = fe.layout.height




local frame = fe.add_rectangle( -30 ,210, 0, 0)
frame.zorder = 4
frame.outline = 5

frame.alpha = 100


// position the frame at the centre of the artwork, to avoid troublesome x offset calculations
frame.anchor = Anchor.Centre
frame.x = snap.x + snap.width / 2
frame.y = snap.y + snap.height / 2
frame.height = snap.height
frame = Inertia( frame, 1000, "alpha");



fe.add_transition_callback( "snap_transition" )
function snap_transition( ttype, var, ttime )
{
    if ( ttype == Transition.ToNewList || ttype == Transition.FromOldSelection )
    {
        // pixel aspect ratio of the artwork
        local par = snap.texture_width.tofloat() / snap.texture_height.tofloat() * snap.sample_aspect_ratio
        frame.width = snap.height * par
        frame.tween_alpha = Tween.Quint;
        frame.loop_alpha = false;
        frame.set_alpha = 0;
        frame.to_alpha = 255;
        frame.delay_alpha = 1000;
    }
    if( ttype == Transition.ToNewSelection){
        frame.alpha = 0
    }
}

justintime

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Determining orientation of game?
« Reply #2 on: October 07, 2024, 04:01:56 PM »
I testd this.  Unfortunately the frame class does not seem to support skew and pinch, and I am trying to get a border around a snap/video that is deformed with a perspective style effect.

Any other ideas welcome!

justintime

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Determining orientation of game?
« Reply #3 on: October 10, 2024, 09:10:33 PM »
I solved this with some ridiculous trickery.  I will have a new very clean theme with some cool fresh effects for everyone in the next few weeks. 

takoni

  • Full Member
  • ***
  • Posts: 51
    • View Profile
Re: Determining orientation of game?
« Reply #4 on: December 05, 2024, 02:56:04 AM »
i solved this , perhaps it help you:
https://youtu.be/Zr8ZmwlTWjg?si=zBTpEqXVVH85-6o1