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.


Topics - liquid8d

Pages: 1 [2] 3
16
Scripting / Genre / Category class and images
« on: October 15, 2015, 12:01:44 AM »
I just spent a little time putting this together. Time to share :) If you like them and want to see other category images added let me know.



You can update mappings for the images to category names in the class, and the class has 3 modes - first match, last match, or random match.

Code: [Select]
local bg = fe.add_artwork("snap", 0, 0, fe.layout.width, fe.layout.height);
local text = fe.add_text("[Title]", 0, 0, fe.layout.width, 75);
local genre_image = fe.add_image("images/unknown.png", fe.layout.width - 188, fe.layout.height - 170, 168, 150);

class GenreImage
{
    mode = 1;       //0 = first match, 1 = last match, 2 = random
    supported = {
        //filename : [ match1, match2 ]
        "action": [ "action" ],
        "adventure": [ "adventure" ],
        "fighting": [ "fighting", "fighter", "beat'em up" ],
        "platformer": [ "platformer", "platform" ],
        "puzzle": [ "puzzle" ],
        "racing": [ "racing", "driving" ],
        "rpg": [ "rpg", "role playing", "role playing game" ],
        "shooter": [ "shooter", "shmup" ],
        "sports": [ "sports", "boxing", "golf", "baseball", "football", "soccer" ],
        "strategy": [ "strategy"]
    }

    ref = null;
    constructor( image )
    {
        ref = image;
        fe.add_transition_callback( this, "transition" );
    }
   
    function transition( ttype, var, ttime )
    {
        if ( ttype == Transition.ToNewSelection || ttype == Transition.ToNewList )
        {
            local cat = " " + fe.game_info(Info.Category, var).tolower();
            local matches = [];
            foreach( key, val in supported )
            {
                foreach( nickname in val )
                {
                    if ( cat.find(nickname, 0) ) matches.push(key);
                }
            }
            if ( matches.len() > 0 )
            {
                switch( mode )
                {
                    case 0:
                        ref.file_name = "images/" + matches[0] + ".png";
                        break;
                    case 1:
                        ref.file_name = "images/" + matches[matches.len() - 1] + ".png";
                        break;
                    case 2:
                        local random_num = floor(((rand() % 1000 ) / 1000.0) * ((matches.len() - 1) - (0 - 1)) + 0);
                        ref.file_name = "images/" + matches[random_num] + ".png";
                        break;
                }
            } else
            {
                ref.file_name = "images/unknown.png";
            }
        }
    }
}

GenreImage(genre_image);




17
General / Simplified Windows native compile w/ MSYS2
« on: September 08, 2015, 09:58:15 PM »
I smacked my head many times trying to get mingw/msys installed with dependencies and  correctly compile AM on Windows natively. This was by far the easiest method and handles all dependencies:

Code: [Select]
Install MSYS2
    https://msys2.github.io/
Launch MSYS2 Shell:
    First, update the system:
    pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
    Close MSYS2 Shell, and run it again
    pacman -Syu
Install requirements ( optionally use mingw-w64-i686-toolchain depending on arch ):
pacman -S git mingw-w64-x86_64-toolchain msys/make mingw64/mingw-w64-x86_64-sfml mingw64/mingw-w64-x86_64-ffmpeg
    [ hit enter to default all installed ]

Clone and Make:
    git clone https://github.com/mickelson/attract
    cd attract
    make

The only thing I don't understand is the required dll's after install. If you add C:\msys64\mingw64\bin to your PATH, it works fine. Is there a way for the required dlls to be included along with the app for a standalone installation?

If these are acceptable, perhaps they can replace the current Native Windows compile instructions on github and a native compile can finally be "supported" :)

https://github.com/mickelson/attract/blob/master/Compile.md#windows-native-compile


18
Scripting / Reset/Reload layout
« on: August 04, 2015, 02:12:03 PM »
Trying to see if there is a way to re-initialize the layout. As far as I can tell, the only related signal I could see might be "reset_window", but that just seems to refresh the AM window, not the layout contents itself.

Any idea if this possible via fe.signal() or some hack?

19
Scripting / ScrollingText module
« on: July 28, 2015, 08:20:56 PM »
Hey all... put together this module because I wanted scrolling text. Still a bit of a WIP, so you'll probably see some goofy things, but feel free to play around with it and give me any feedback..

https://www.youtube.com/watch?v=3YZWja4z7sk

It works by creating a surface and a text object for each scrolling text. Use is basically:
Code: [Select]
fe.load_module("objects/scrollingtext");
local scroller = ScrollingText.add( "[Title]", 25, 50, fe.layout.width - 25, 75, ScrollType.HORIZONTAL_LEFT );

//there is a couple wrapper functions for color:
scroller.set_rgb( 255, 0, 0 );  //the text color
scroller.set_bg_rgb( 0, 0, 0 ); //the surface color (uses a pixel.png to color the surface)
//scroller.set_pos( 0, 0, 100, 100 ); //the surface x, y, w, h

//you can access the surface and text objects directly
//scroller.surface <- the surface
//scroller.text <- the text object

//There are also some settings:
scroller.settings.delay = 500;
scroller.settings.loop = -1;

The module is in my github in modules/objects (make sure to grab the .nut and the folder and put it in modules/objects):
https://github.com/liquid8d/attract-extra/tree/master/modules/objects

A sample layout is available there as well:
https://github.com/liquid8d/attract-extra/tree/master/layouts/sample_objects_scrollingtext

For details on use, look in the modules/objects/scrollingtext.nut file

20
Scripting / Discussion of creating Aspect-Aware Layouts
« on: June 15, 2015, 10:04:00 PM »
Continuing discussion of:
http://forum.attractmode.org/index.php?topic=272.0

I'd like to see a sort of unified way of designing layouts, ensuring they work well for all aspect ratios. Many people design their layouts with a single resolution / aspect in mind which will scale/stretch but not look as nice in other aspects / resolutions.

There's two things I'd like to see to help with this:

Storing 'set' values at the top of your layout, then set them from the variables in your layout code

Here's an example:
Code: [Select]
LAYOUT_SETTINGS <- {
   rotate_90 = {
      width = fe.layout.height,
      height = fe.layout.width,
      title = { x = 0, y = fe.layout.height / 1.08 },
      wheel = { x = 0, y = fe.layout.height / 1.20, x_divisor = 2.8 },
   },
   default = {
      width = fe.layout.width,
      height = fe.layout.height,
      title = { x = 0, y = fe.layout.height / 1.10 },
      wheel = { x = 0, y = fe.layout.height / 1.33, x_divisor = 2.4 },
   }
}

local values = LAYOUT_SETTINGS["default"];
if (( actual_rotation == RotateScreen.Left ) || ( actual_rotation == RotateScreen.Right )) values = LAYOUT_SETTINGS["rotate_90"];

//now we just reference values for everything when setting positions and sizes for objects...
title.x = values.title.x;
wheel.y = values.wheel.y;

This is a personal preference, but tables are a good way to store a lot of values and a lot of values within values without your code getting out of hand. It's is however important to be careful with table syntax and formatting it for good readability. It's  also better than arrays for readability because you will use word references like values.title.y instead of values[2][1]. You can also store alternate settings for your objects and keep the original values to reference back if needed.

You wouldn't have to use tables, but it's a good idea for all your initial values to be in one location, preferably at the top of the layout code.

Prepare layouts that will work in multiple aspects

Most major changes to your layout will probably be objects position and size.

If you go by my table suggestion, you can have a table that stores settings for each object at each individual aspect / resolution you want to support, then reference something like values[current_aspect].title.x in your code.

Otherwise, if you just keep all your settings in variables at the top, it will be easy to make a copy of your layout, store it as layout-altaspect.nut and adjust your variables to work with the new aspects / resolution.

Either way, we could make it easy to add a user config option of Aspect: standard,widescreen,etc. and use the correct values or load the appropriate layout.

Just some ideas I had when it comes to cleaning up code and making it easier to deal with multiple layout configurations. Perhaps a couple templates for creating multiple-aspect layouts would be helpful?


21
Was doing a bunch of stuff in AM this weekend, and I realized there isn't much in the way of explaining how to create layouts.

So I started an article on the wiki:

https://github.com/mickelson/attract/wiki/Introduction-to-Squirrel-Programming

This is meant for beginners and (hopefully) non-programmers, so let me know if it sounds too complicated. I'll probably break this down into different articles once it's closer to being finished.

Right now it explains the basics of Squirrel, and walks you through creating a simple layout. Here is the final layout it helps you create:

Feedback is appreciated!




22
General / Steam sale
« on: June 14, 2015, 07:07:49 PM »
Looks like a bunch of stuff on sale at Steam. I just grabbed some things on my wishlist, a few I want to see how cab friendly they are.

Any suggestions??

23
Scripting / IntroVid plugin
« on: June 13, 2015, 12:08:00 PM »
Just so anyone looking for scripts will find it here:

I just whipped up this plugin (attached) - hopefully there are no issues, but might require some updates if you find any.

Copy the IntroVid.nut into your plugins/ folder.
Launch AM, hit TAB (Settings), Plugins, IntroVid
 Set Enable to Yes
 Set Filename to the filename of the video (if you don't put a path, it will be looking in your current layout folder
 Set Audio to No if you don't want it to play the Intro audio

The next time you start AM, it should play the intro. If you press any key, it will skip it.

It is also on my GitHub, where I will do any updates:
https://github.com/liquid8d/attract-extra/blob/master/plugins/IntroVid.nut

24
General / Compiling AM on Windows
« on: June 10, 2015, 12:06:14 PM »
Perhaps we can get a Development sub also? :)

I'm trying to compile AM on Windows (multiple versions, same result)- I have some experience with this but it's very possible I didn't install something with MinGW/msys...

make output:
Code: [Select]
g++ -c -o obj/fe_base.o src/fe_base.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_util.o src/fe_util.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_util_sq.o src/fe_util_sq.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_info.o src/fe_info.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_input.o src/fe_input.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_romlist.o src/fe_romlist.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_xml.o src/fe_xml.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_settings.o src/fe_settings.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_build.o src/fe_build.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_config.o src/fe_config.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_presentable.o src/fe_presentable.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_present.o src/fe_present.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/sprite.o src/sprite.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_image.o src/fe_image.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_sound.o src/fe_sound.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_shader.o src/fe_shader.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_overlay.o src/fe_overlay.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_window.o src/fe_window.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/tp.o src/tp.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_text.o src/fe_text.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_listbox.o src/fe_listbox.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE
g++ -c -o obj/fe_vm.o src/fe_vm.cpp  -mconsole -O2  -Iextlibs/expat -Iextlibs/squirrel/include -Iextlibs/sqrat/include  -DNO_MOVIE

All goes smoothly until fe_vm when I start getting errors for missing SqOverloadFunc:
Code: [Select]
extlibs/sqrat/include/sqrat/sqratClass.h:277: error: no matching function for call to `SqOverloadFunc(void (FeShader::*&)(const char*, FeImage*))'
make: *** [obj/fe_vm.o] Error 1

Any ideas?

25
Themes / Console Theme WIP
« on: June 03, 2015, 10:23:41 PM »
Finally played around with an actual theme today! I don't get to do that often :)

Wanted to mess with reflections and I'm trying to work on a new "conveyor" option using my animate module so I decided to come up with a theme.

This is what I have so far:



A title/info thing drops down, then fades after a few seconds:



I really want to thank verion for the work he's doing! I used some assets he provided and one I found on google to get this TV result:



I'm attaching that image here, in case anyone is interested in using it. The theme is still a ways off.

26
General / Capturing Attract Mode video with OBS
« on: June 02, 2015, 07:30:18 PM »
I use OBS (https://obsproject.com/) to do capturing of AM, and recently I've noticed issues trying to record video. I can't seem to record AM in Window, Fill Screen or Fullscreen mode - I just get a white screen.

I'm pretty sure I was able to in the past, but I don't know if it's a newer version of OBS or AM that might be causing issues. But I can capture a whole monitor and the AM window content shows up.

I'm not sure if this is just an OBS bug or not - AM uses SMFL right? So in Windows is it just OpenGL or does it use DirectDraw/Direct3D?? Why might it capture with the window when capturing the full monitor, but not a window or with full screen?

27
Scripting / XML module WIP - Who wants to create layouts in xml? :)
« on: May 24, 2015, 01:17:05 AM »
Early phases here, but a lot of possibilities once it's working well. I've got crude xml loading, and I have a custom layout that reads a "Theme.xml" file and creates the layout based on it. This can open up the possibility of reading xml themes from other FE's - although it'd have to be coded to support the format, and may be missing features that don't translate to AM.

My plan for now is to make a layout that can read multiple themes from the layout folder, just choose them from the layout options. If you have suggestions or thoughts, let me know.




28
Scripting / animate module
« on: May 17, 2015, 12:34:10 PM »
I was previously working on a whole ExtendedObjects and Animate module. It got a bit overwhelming, and I really wanted the animation parts to be available to everyone, so I sort of rewrote from scratch a new "animate" module.

It's currently in my github for anyone that would like to test it out:
https://github.com/liquid8d/attract-extra/tree/master/modules/animate

There is also some sample layouts that show how to use different animations:
https://github.com/liquid8d/attract-extra/tree/master/layouts

There is still some buggy issues I need to work out, particularly centering objects properly (doesn't work with skew/pinch right now) and a bunch of misc. stuff, but hopefully this helps some people add some nice transition animations without having to write your own transition callbacks and handle everything.

An example of how easy this makes animations:

Code: [Select]
fe.load_module("animate/animate");

//property animation - can be used for any properties that has a numeric value
local logo = fe.add_image("default.png", 0, 100, 640, 360);
local alpha_cfg = {
    when = Transition.ToNewSelection,
    property = "alpha",
    start = 0,
    end = 255,
    time = 1000
}
animation.add( PropertyAnimation( logo, alpha_cfg ) );

//sprite animation - use a spritesheet to animate specific frames of the sprite sheet
local joystick = fe.add_image("joystick-move.png", (fe.layout.width / 2) - 296, fe.layout.height - 128, 128, 128);
local sprite_cfg = {
    when = When.Always,
    width = 128,
    frame = 0,
    time = 3000,
    order = [ 0, 3, 0, 3, 0, 4, 0, 4 ],
    loop = true
}
animation.add( SpriteAnimation( joystick, sprite_cfg ) );

//particle animation - create particle effects
local particle_cfg = {
    resources = [ "default.png" ],
    ppm = 60,
    x = 0,
    y = 0,
    width = fe.layout.width,
    speed = [ 100, 250 ],
    angle = [ 0, 180 ],
    startScale = [ 1, 2 ],
    gravity = 1,
    fade = 10000,
    lifespan = 10000
}
animation.add( ParticleAnimation( particle_cfg ) );


I should be able to work to improve this in the next couple weeks. I hope a few will test it out and provide any feedback. Once I can get some issues corrected, hopefully this module can be included in the next version of Attract Mode by default :)

29
Scripting / AttractMode Reference Sheets
« on: March 12, 2015, 11:35:22 PM »
I'm getting pretty deep into some coding, but I keep having to go back and look at the thorough documentation :)
https://github.com/mickelson/attract/blob/v1.5.0/Layouts.md

So I put together these reference sheets, hopefully someone finds them useful :) I will try to update them from time to time.. I may add some squirrel info on there at some point.


30
Scripting / Saving Layout State after Screensaver?
« on: March 05, 2015, 09:59:10 PM »
So, I'm just now realizing this, but it may be an important thing to keep in mind when creating layouts.. but since the screensaver is a layout, and your layout is re-loaded when returning to it, it can have some adverse effects:

Code: [Select]
local text = fe.add_text("Move me", 0, 0, 300, 30);
fe.add_transition_callback("transition_callback" );

function transition_callback(ttype, var, ttime)
{
    if (ttype == Transition.ToNewSelection)
    {
        text.y = 100;
    }
}

With code like this, that means if the transition had already occurred before the screensaver, the object will get put back to the original position when returning from the screensaver.

First, is screensaver the only thing that might cause your layout to be reloaded, or are there other scenarios (apart from loading a different layout)?

Second, what's the best way to "save state" here? Wherever my objects are when the screensaver occurs, that's where i want them to be when it comes back.

Should we be storing values of object properties when we alter them, in order to restore when re-loading the layout?

I'm having one of "those" coding days, so maybe I'm just completely doing something stupid.

Pages: 1 [2] 3