Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kitsune42k

Pages: [1]
1
Themes / Re: [Help] Image format based on emulator
« on: October 31, 2015, 07:32:01 PM »
Thanks  ;)

i have two more questions:

1. how do i save the width/height of a picture in a variable to center the image on x/y Solved
Code: [Select]
function screens_width()
{
   local sw = screens.texture_width;
   return sw;
}
fe.add_text( "[!screens_width]", 0, 0 );

1b. now i stuck on how to convert a magic token into a integer Solved
Code: [Select]
fe.layout.width=1920;
fe.layout.height=1080;

local lw = fe.layout.width;
local lh = fe.layout.height;

local img = fe.add_artwork( "img.png" );
img.preserve_aspect_ratio = true;

function img_width() return img.texture_width;
function img_height() return img.texture_height;

fe.add_transition_callback( "center_image" );
function center_image( ttype, var, ttime ) {
switch ( ttype ) {
case Transition.ToNewList:
case Transition.ToNewSelection:
img.x = (lw/2)-(img_width()/2);
img.y = (lh/2)-(img_height()/2);
break;
}
return false;
}

2. how do i compare a string? [if ( string == "text")?] Solved

ps, progress update:

2
Themes / [Help] Image format based on emulator
« on: October 31, 2015, 12:20:52 PM »
Hey ho  ;)

First of, I'm sorry for my English. I'm from Germany.

I trying to make a very modern looking Layout, but i stuck a little.

This is the actual progress of my layout:


I want to fix the size of the Boxart(flyer) and the screenshots, so all images of that type have the same size after scraping.

But i need to scale them, without changing there aspect ration.

I'm new with Squirrel but this is what i came up with:
Code: [Select]
// here Variables with width and hight of the different consoles

local emu = "[Emulator]";

local ttext = fe.add_text( "test", 640, 990, 640, 90 );    // for testing
local screenshot = fe.add_artwork( "screens", 640, 0, sceenshot_width, sceenshot_height );

if ( emu == "gb" ) {
    local sceenshot_width = gb_width * 8;
    local sceenshot_height = gb_height * 8;
    ttext.text.msg = "gb";    // for testing
}

The sting is working, when i use this it prints gb:
Code: [Select]
local ttext = fe.add_text( emu, 640, 990, 640, 90 );    // for testing
What am I doing wrong, or is there a better solution?

Pages: [1]