Recent Posts

Pages: 1 ... 8 9 [10]
91
Scripting / Re: Problem plugin - Random
« Last post by keilmillerjr on October 09, 2018, 07:24:27 PM »
Updated the experimental branch for sequencer plugin. Sorry it took so long. I just spent two hours with it. I added the ability to jump ahead indexes. It makes the action quicker. Anyone can try it and provide input or fork/pull request. Still hung up on why fe.signal on every consecutive tick does not produce the same result as navigation button press. My frame rate gets low too.
92
Scripting / Re: ScrollingText module
« Last post by jedione on October 09, 2018, 07:15:57 PM »
well yes ,, the layout.. :o
93
Scripting / Re: ScrollingText module
« Last post by Steven Campoli on October 09, 2018, 05:17:48 PM »
Hey, thanks for the reply

Where do I paste this?
In the layout.nut file?
94
Scripting / Re: GLSL colorizer and color conversion routines
« Last post by zpaolo11x on October 09, 2018, 10:18:07 AM »
And this is a simple "desaturate" filter, it uses luminosity from HSL instead of HSV, it looks more natural in my opinion...

Code: [Select]
uniform sampler2D texture;

float luminosity( in vec3 c ){
float s = 0.0;
float l = 0.0;

float cMin = min( c.r, min( c.g, c.b ) );
float cMax = max( c.r, max( c.g, c.b ) );
l = ( cMax + cMin ) / 2.0;

if ( cMax > cMin ) {
float cDelta = cMax - cMin;
       
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
       
}
return float( l );
}


void main()
{   

vec2 uv = gl_TexCoord[0].xy;
vec4 t0 = texture2D(texture, uv);
float hsl0 = luminosity (t0.rgb);

gl_FragColor = vec4(vec3(hsl0) , gl_Color.a*t0.a);

}
95
Scripting / GLSL colorizer and color conversion routines
« Last post by zpaolo11x on October 09, 2018, 07:46:44 AM »
I jsut developed a small shader for colorizing, it uses HSL color space which looks much better than HSV. But in the code you can find some useful color conversion functions that you can use for many purposes like desaturation, hue rotation etc.

The shader requires an HSL vector of three values that are used for colorizing, plus a texture mix value if you want to blend (in RGB) the colorized with the default image.

Code: [Select]
uniform sampler2D texture;
uniform vec3 hsl;
uniform float texmix;

vec3 hsl2rgb( in vec3 c )
{
    vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 );
    return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));
}

vec3 rgb2hsl( in vec3 c ){
  float h = 0.0;
float s = 0.0;
float l = 0.0;
float r = c.r;
float g = c.g;
float b = c.b;
float cMin = min( r, min( g, b ) );
float cMax = max( r, max( g, b ) );

l = ( cMax + cMin ) / 2.0;
if ( cMax > cMin ) {
float cDelta = cMax - cMin;
       
        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original
s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) );
       
if ( r == cMax ) {
h = ( g - b ) / cDelta;
} else if ( g == cMax ) {
h = 2.0 + ( b - r ) / cDelta;
} else {
h = 4.0 + ( r - g ) / cDelta;
}

if ( h < 0.0) {
h += 6.0;
}
h = h / 6.0;
}
return vec3( h, s, l );
}


vec3 rgb2hsv(vec3 c)
{
    vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
    vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
    vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));

    float d = q.x - min(q.w, q.y);
    float e = 1.0e-10;
    return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void main()
{   

vec2 uv = gl_TexCoord[0].xy;

vec4 t0 = texture2D(texture, uv);
vec3 hsl0 = rgb2hsl (t0.rgb);

vec3 hsl1 = vec3(hsl.x,hsl.y,hsl0.z);

vec3 tch = hsl2rgb (hsl1);


gl_FragColor = vec4(mix(hsl.z*tch.xyz,t0.xyz,texmix) , gl_Color.a*t0.a);

}

This is a sample layout

Code: [Select]
local pic1 = fe.add_artwork("snap",0,0,400,400)
pic1.video_flags = Vid.ImagesOnly
pic1.preserve_aspect_ratio = false

local pic2 = fe.add_artwork("snap",400,0,400,400)
pic2.video_flags = Vid.ImagesOnly
pic2.preserve_aspect_ratio = false

local pic3 = fe.add_artwork("snap",800,0,400,400)
pic3.video_flags = Vid.ImagesOnly
pic3.preserve_aspect_ratio = false

local colorshader1 = fe.add_shader(Shader.Fragment,"colorizer.glsl")
colorshader1.set_texture_param("texture")
colorshader1.set_param("hsl",0.6,0.5,1.0)
colorshader1.set_param("texmix",0.0)
pic1.shader = colorshader1

local colorshader2 = fe.add_shader(Shader.Fragment,"colorizer.glsl")
colorshader2.set_texture_param("texture")
colorshader2.set_param("hsl",0.6,1.0,1.0)
colorshader2.set_param("texmix",0.0)
pic2.shader = colorshader2


96
Scripting / Re: ScrollingText module
« Last post by jedione on October 09, 2018, 06:05:15 AM »
here is one i use a theme....
Code: [Select]
// srolling text game title
local scroller1 = ScrollingText.add( "[Title]", 0, 0, 300, 45, ScrollType.HORIZONTAL_LEFT );

//scroller1.set_bg_rgb(0, 220, 0, 150);
scroller1.set_rgb( 255, 0, 0 );
//scroller1.text.font = "time";
scroller1.text.charsize = 36;
scroller1.set_pos( 805, 208, 311, 30 );
scroller1.settings.speed_x = 1.9;
//fixed_width = 1000;
//scroller.settings.delay = 250;
//scroller.settings.loop = 5;

uncomment the font time and replace with your one font....peace
97
Scripting / Re: Last Played Games - Most recent Games list
« Last post by spud1 on October 09, 2018, 02:43:03 AM »
I wound up solving the problem I had by creating a separate plugin rather than including the code in the layout.nut.

The LastPlayedGame.nut plugin looks like this:

Code: [Select]
// This plugin saves the most recently played game to the "Last_Played_Games.txt" romlist
fe.add_transition_callback( "most_recent_game" );
function most_recent_game( ttype, var, ttime )
{
 switch ( ttype )
 {
  case Transition.ToGame:
                system( "echo '" + fe.game_info( Info.Name ) + ";" + fe.game_info( Info.Title ) + ";" + fe.game_info( Info.Emulator ) + ";" + fe.game_info( Info.CloneOf ) + ";" + fe.game_info( Info.Year ) + ";" + fe.game_info( Info.Manufacturer ) + ";" + fe.game_info( Info.Category ) + ";" + fe.game_info( Info.Players ) + ";" + fe.game_info( Info.Rotation ) + ";" + fe.game_info( Info.Control ) + ";" + fe.game_info( Info.Status ) + ";" + fe.game_info( Info.DisplayCount ) + ";" + fe.game_info( Info.DisplayType ) + ";" + fe.game_info( Info.AltRomname ) + ";" + fe.game_info( Info.AltTitle ) + ";" + fe.game_info( Info.Extra ) + ";" + fe.game_info( Info.Buttons ) + "' >> ~/.attract/romlists/Last_Played_Games.txt" ); // Takes the details of the game most recently played and inserts them at the end of the Last_Played_Games.txt romlist
                system( "tac ~/.attract/romlists/Last_Played_Games.txt | awk 'NR==1 {a=$0; next} 1; END{print a}' | tac > ~/.attract/romlists/Last_Played_Games1.txt && rm ~/.attract/romlists/Last_Played_Games.txt && mv ~/.attract/romlists/Last_Played_Games1.txt ~/.attract/romlists/Last_Played_Games.txt" ); // Takes the Game's details and moves them to the start of the romlist
                system( "awk '!/Mode/' ~/.attract/romlists/Last_Played_Games.txt > ~/.attract/romlists/Last_Played_Games1.txt && rm ~/.attract/romlists/Last_Played_Games.txt && mv ~/.attract/romlists/Last_Played_Games1.txt ~/.attract/romlists/Last_Played_Games.txt" ); // Removes any reference in the romlist to a restart of Attract Mode
                system( "awk '!x[$0]++' ~/.attract/romlists/Last_Played_Games.txt > ~/.attract/romlists/Last_Played_Games1.txt && rm ~/.attract/romlists/Last_Played_Games.txt && mv ~/.attract/romlists/Last_Played_Games1.txt ~/.attract/romlists/Last_Played_Games.txt" ); // Removes duplicate entries in the romlist, leaving only the first (and most recent) entry for a particular game
                system( "head -51 ~/.attract/romlists/Last_Played_Games.txt > ~/.attract/romlists/Last_Played_Games1.txt && rm ~/.attract/romlists/Last_Played_Games.txt && mv ~/.attract/romlists/Last_Played_Games1.txt ~/.attract/romlists/Last_Played_Games.txt" ); // Limits the number of entries in the romlist to 51
        return false;
}}

You could safely remove the third "system" line - that is unique to my system.

Don't forget to enable the plugin.  I have set up a "Most Recent Games" display for the "Last_Played_Games.txt" romlist and it is working perfectly for me.
98
Themes / Re: HyperPie2 Theme [V2 Released]
« Last post by Steven Campoli on October 09, 2018, 12:45:51 AM »
Hey! How do I get the console descriptions on the main menu?
99
Scripting / Re: ScrollingText module
« Last post by Steven Campoli on October 08, 2018, 08:35:53 PM »
How do I use this?
I have the module but how do I make it work?
I also pasted it in the plugins folder and enabled it but still doesn’t work?
100
Scripting / Scrolling text module : How to...
« Last post by Steven Campoli on October 08, 2018, 08:30:41 PM »
In the modules folder I see scrolling text.nut
How do I activate this so my text at this of the systems menu scroll?
Pages: 1 ... 8 9 [10]