1
Themes / Re: I present... AMBuilder: Layout Designer!
« on: June 23, 2023, 11:24:08 AM »
Great program but incomplete IMHO (or maybe I didn't understand something).
For some reason the outpout layout is tiny and sticks to the top left of the screen.
![](https://www.cdlab.it/am.jpg)
I couldn't find any way to centre it and zoom it to make it occupy the whole screen while maintaining the aspect ratio.
I have a normal 40 inch TV and I want a 4:3 layout like Attrac-Man for example.
Has anyone succeeded?
Here is my layout.nut
thats my wanted behaviour
![](https://www.cdlab.it/wanted.jpg)
with font Emulogic.TTF
Thanks
For some reason the outpout layout is tiny and sticks to the top left of the screen.
![](https://www.cdlab.it/am.jpg)
I couldn't find any way to centre it and zoom it to make it occupy the whole screen while maintaining the aspect ratio.
I have a normal 40 inch TV and I want a 4:3 layout like Attrac-Man for example.
Has anyone succeeded?
Here is my layout.nut
Code: [Select]
///////////////////////////////////////
// Generated with AMBuilder 1.0
// https://github.com/liquid8d/am-builder
///////////////////////////////////////
//layout configuration
//fe.layout.width = 640
//fe.layout.height = 480
fe.layout.preserve_aspect_ratio = true
fe.layout.font = "Arial"
fe.layout.base_rotation = RotateScreen.None
fe.layout.toggle_rotation = RotateScreen.None
fe.layout.page_size = 10
// Stored Object Properties
local props = {"Standard (4x3)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"Standard Vert (3x4)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"SXGA (5x4)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"Wide (16x10)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"Wide Vert (10x16)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"HD (16x9)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}},"HD Vert (9x16)":{"AMImage1":{"x":0,"y":0,"width":640,"height":480,"visible":true,"rotation":0,"zorder":-1,"file_name":"stars.gif","preserve_aspect_ratio":false,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMArtwork2":{"x":120,"y":0,"width":390,"height":300,"visible":true,"rotation":0,"zorder":-1,"file_name":"snap","preserve_aspect_ratio":true,"video_flags":0,"video_playing":false,"smooth":true,"trigger":Transition.ToNewSelection,"red":255,"green":255,"blue":255,"alpha":255,"origin_x":0,"origin_y":0,"subimg_x":0,"subimg_y":0,"subimg_width":0,"subimg_height":0,"skew_x":0,"skew_y":0,"pinch_x":0,"pinch_y":0,"index_offset":0,"filter_offset":0,"shader":""},"AMListBox3":{"x":120,"y":300,"width":390,"height":180,"visible":true,"rotation":0,"zorder":-1,"format_string":"[Title]","font":"Emulogic","charsize":12,"align":Align.Centre,"style":0,"rows":11,"red":255,"green":255,"blue":255,"alpha":255,"bg_red":0,"bg_green":0,"bg_blue":0,"bg_alpha":0,"sel_red":255,"sel_green":255,"sel_blue":0,"sel_alpha":255,"sel_style":0,"selbg_red":0,"selbg_green":0,"selbg_blue":255,"selbg_alpha":255,"shader":""}}}
// Find correct aspect
function findAspect( ratio ) {
if ( ratio == 1.77778 ) return "HD (16x9)"
else if ( ratio == 1.6 ) return "Wide (16x10)"
else if ( ratio == 1.33333 ) return "Standard (4x3)"
else if ( ratio == 1.25 ) return "SXGA (5x4)"
else if ( ratio == 0.625 ) return "Wide Vert (10x16)"
else if ( ratio == 0.5625 ) return "HD Vert (9x16)"
else if ( ratio == 0.75 ) return "Standard Vert (3x4)"
//use default aspect
print("Unrecognized or missing aspect, using default: Standard (4x3)")
return "Standard (4x3)"
}
local aspects = ["Standard (4x3)","Standard Vert (3x4)","SXGA (5x4)","Wide (16x10)","Wide Vert (10x16)","HD (16x9)","HD Vert (9x16)"]
local aspect = findAspect( ScreenWidth / ( ScreenHeight * 1.0 ) )
print( "Layout Aspect: " + aspect + "\n ")
// Create AM Objects
local AMImage1 = fe.add_image( "resources/" + props[aspect]["AMImage1"].file_name, -1, -1, 1, 1)
foreach( key, val in props[aspect]["AMImage1"] )
if ( key != "file_name" && key != "subimg_width" && key != "subimg_height" && key != "zorder" && key != "shader" )
try { AMImage1[key] = val } catch(e) { print("error setting property: " + key + "\n" ) }
local AMArtwork2 = fe.add_artwork( props[aspect]["AMArtwork2"].file_name, -1, -1, 1, 1)
foreach( key, val in props[aspect]["AMArtwork2"] )
if ( key != "file_name" && key != "subimg_width" && key != "subimg_height" && key != "zorder" && key != "shader" )
try { AMArtwork2[key] = val } catch(e) { print("error setting property: " + key + "\n" ) }
local AMListBox3 = fe.add_listbox( -1, -1, 1, 1)
foreach( key, val in props[aspect]["AMListBox3"] )
if ( key != "zorder" && key != "shader" )
try { AMListBox3[key] = val } catch(e) { print("error setting property: " + key + "\n" ) }
// Begin Triggers
/*
local triggers = [triggers]
fe.add_transition_callback(this, "on_transition")
fe.add_ticks_callback(this, "on_tick")
function on_transition( ttype, var, ttime ) {
return false
}
function on_tick( ttime ) {
}
*/
thats my wanted behaviour
![](https://www.cdlab.it/wanted.jpg)
with font Emulogic.TTF
Thanks