Compare commits

..

No commits in common. "15b15b90858039461cf9290f652f4cb5fc387d1c" and "110847e9e66a436d84279f41037dfb93e428f360" have entirely different histories.

3 changed files with 16 additions and 11 deletions

View File

@ -12,14 +12,14 @@ screen color_picker(color, alpha, title, pos_xy, color_default):
default hue = 0
default sat = 0
default val = 0
default alpha_ = 0 # Avoid name conflict with 'alpha' screen variable in other active screens
default _alpha = 0 # Avoid name conflict with 'alpha' screen variable in other active screens
default edit_mode = False
default preview_old = Solid(rgba)
$ preview_new = Solid(rgba)
$ gradient_map = SVGradientButton(
color_picker_clicked,
Fixed(
Color(hsv=(1-hue, 1, 1)),
Color( tuple( x * 255 for x in colorsys.hsv_to_rgb(1 - hue, 1, 1) ) ),
Frame("interface/color_picker/saturation_value_gradient.webp")
),
xysize=(255, 255),
@ -213,7 +213,7 @@ screen color_picker(color, alpha, title, pos_xy, color_default):
Transform(alpha_gradient_image, matrixcolor=ColorizeMatrix(rgba, rgba)))
bar:
xysize (255, 30)
value ScreenVariableValue("alpha_", range=1.0, action=Function(color_picker_update_rgba))
value ScreenVariableValue("_alpha", range=1.0, action=Function(color_picker_update_rgba))
base_bar icon_frame
thumb Image(gui.format("interface/color_picker/{}/cursor_v.webp"), xalign=0.5)
thumb_offset 0
@ -234,9 +234,11 @@ define hue_gradient_image = HueSlider()
init -1 python:
def color_picker(color=(0,0,0,0), alpha=True, title="Pick a colour", pos_xy=(240, 130), color_default=None):
def color_picker(color=[0,0,0,0], alpha=True, title="Pick a colour", pos_xy=(240, 130), color_default=None):
# TODO: Remove external dependencies and utilise built-in Color class instead.
global picking_color
picking_color = list(color) # Color object (list) to be updated live
picking_color = color # Color object (list) to be updated live
start_color = list(color) # Keep a copy
renpy.show_screen("color_picker", tuple(color), alpha, title, pos_xy, color_default)
@ -303,19 +305,19 @@ init -1 python:
def color_picker_update_hsva():
scope = renpy.get_screen("color_picker").scope
(r, g, b, a) = scope["rgba"]
(h, s, v) = Color((r, g, b)).hsv
(h, s, v) = colorsys.rgb_to_hsv(r / 255.0, g / 255.0, b / 255.0)
scope["hue"] = 1 - h
scope["sat"] = s
scope["val"] = v
scope["alpha_"] = a / 255.0
scope["_alpha"] = a / 255.0
def color_picker_update_rgba():
scope = renpy.get_screen("color_picker").scope
(r, g, b) = Color(hsv=(1 - scope["hue"], scope["sat"], scope["val"])).rgb
(r, g, b) = colorsys.hsv_to_rgb(1 - scope["hue"], scope["sat"], scope["val"])
r = int(r * 255)
g = int(g * 255)
b = int(b * 255)
a = int(scope["alpha_"] * 255)
a = int(scope["_alpha"] * 255)
scope["rgba"] = (r, g, b, a)
update_picking_color(scope["rgba"])
renpy.restart_interaction()
@ -426,7 +428,9 @@ init -1 python:
class SVGradientButton(ImageButton):
def __init__(self, on_click, idle_image, *args, **kwargs):
super(SVGradientButton, self).__init__(idle_image, *args, sensitive=True, action=NullAction(), **kwargs)
kwargs['sensitive'] = True
kwargs['action'] = NullAction()
super(SVGradientButton, self).__init__(idle_image, *args, **kwargs)
self.width = 0
self.height = 0
self.on_click = on_click

View File

@ -61,7 +61,7 @@ label credits:
if not _menu:
play music "music/Only 115 (Electro Loop)_125 BPM.ogg" fadein 1 fadeout 1 if_changed
scene onlayer screens
$ renpy.scene("screens")
show screen credits(credits_text)
with dissolve

View File

@ -5,6 +5,7 @@ init python early:
import math
import random
import pygame
import colorsys
import fnmatch
import posixpath
import re