Making a hue-shifting slider [Solved]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Making a hue-shifting slider [Solved]

#1 Post by SundownKid » Mon Dec 01, 2014 10:46 am

I am trying to make a slider where you can have a base image (of hair, for instance) and select hair color of a character using the slider to customize the character. There would be 3 sliders, Red, Green and Blue, which would change the amount of said color in the hair in real time as you moved the slider. So, how is it possible to do that in real time? Does it have something to do with the hue shifting functionality?
Last edited by SundownKid on Fri Dec 12, 2014 10:23 pm, edited 1 time in total.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Making a hue-shifting slider

#2 Post by nyaatrap » Mon Dec 01, 2014 11:09 am

DynamicDisplayable(im.matrix.tint(value_changed_by_screen_slider_1, ....)) might be possible, but it must have huge disadvantage on performance. I don't know it's practically bearable to play a game. Currently, there's no way to change colors with hardware acceleration.

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Making a hue-shifting slider

#3 Post by SundownKid » Mon Dec 01, 2014 2:49 pm

That is interesting. Well, I will try the dynamic version to see if it works, otherwise simply have a number of selectable colors instead.

P.S. Maybe you could put a code sample of being used with, say, "test.png"? I still don't quite understand how the code would be formatted.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Making a hue-shifting slider

#4 Post by nyaatrap » Mon Dec 01, 2014 9:26 pm

Code: Select all

def render_image(st,at,char):
    return im.MatrixColor(char, im.matrix.tint(r, g, b)), .1 #re-render in 0.1 seconds. try .5 if performance is poor.

image girl = DynamicDisplayable(render_image, char="girl.png")
Code is something like the above. I didn't test it, but if you make a screen which changes variables: r, g, b, then it'll work.

User avatar
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Making a hue-shifting slider [Solved]

#5 Post by SundownKid » Fri Dec 12, 2014 10:24 pm

Well the top part had to be put in an 'init python' block but otherwise it worked fine. It seems to be working albeit with some slight lag but that's better than nothing. Thanks!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Dav, ph14basicbitch