1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Merge pull request #40 from greusser/master

Added a basic palette
This commit is contained in:
Overloaded 2019-12-15 01:43:53 +02:00 committed by GitHub
commit 002491febe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 281 additions and 88 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/palette_button.png-e0803e14098fd441f88c7f2c14f6ef20.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Palette/palette_button.png"
dest_files=[ "res://.import/palette_button.png-e0803e14098fd441f88c7f2c14f6ef20.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/palette_button_fill.png-9b3cd2eeba6121823e5d065e322cedef.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Palette/palette_button_fill.png"
dest_files=[ "res://.import/palette_button_fill.png-9b3cd2eeba6121823e5d065e322cedef.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

170
Main.tscn

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,32 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_hover.tres" type="StyleBox" id=1]
[ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_pressedr.tres" type="StyleBox" id=2]
[ext_resource path="res://Themes & Styles/StyleBoxes/palette_stylebox_normal.tres" type="StyleBox" id=3]
[ext_resource path="res://Assets/Graphics/Palette/palette_button_fill.png" type="Texture" id=4]
[sub_resource type="ImageTexture" id=1]
[node name="PaletteButton" type="Button"]
margin_right = 22.0
margin_bottom = 22.0
rect_min_size = Vector2( 22, 22 )
custom_styles/hover = ExtResource( 1 )
custom_styles/pressed = ExtResource( 2 )
custom_styles/normal = ExtResource( 3 )
icon = SubResource( 1 )
[node name="NinePatchRect" type="NinePatchRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 1.0
margin_top = 1.0
margin_right = -1.0
margin_bottom = -1.0
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 4 )
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2

View file

@ -0,0 +1,61 @@
extends GridContainer
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var palette_button = load("res://Prefabs/PaletteButton.tscn");
var default_palette = [
Color("#FF000000"),
Color("#FF222034"),
Color("#FF45283c"),
Color("#FF663931"),
Color("#FF8f563b"),
Color("#FFdf7126"),
Color("#FFd9a066"),
Color("#FFeec39a"),
Color("#FFfbf236"),
Color("#FF99e550"),
Color("#FF6abe30"),
Color("#FF37946e"),
Color("#FF4b692f"),
Color("#FF524b24"),
Color("#FF323c39"),
Color("#FF3f3f74"),
Color("#FF306082"),
Color("#FF5b6ee1"),
Color("#FF639bff"),
Color("#FF5fcde4"),
Color("#FFcbdbfc"),
Color("#FFffffff"),
Color("#FF9badb7"),
Color("#FF847e87"),
Color("#FF696a6a"),
Color("#FF595652"),
Color("#FF76428a"),
Color("#FFac3232"),
Color("#FFd95763"),
Color("#FFd77bba"),
Color("#FF8f974a"),
Color("#FF8a6f30")
]
# Called when the node enters the scene tree for the first time.
func _ready():
var index = 0
for color in default_palette:
var new_button = palette_button.instance()
new_button.get_child(0).modulate = color
new_button.connect("pressed", self, "_on_color_select", [index])
add_child(new_button)
index += 1
pass # Replace with function body.
func _on_color_select(index):
Global.left_color_picker.color = default_palette[index]
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -4,3 +4,5 @@
[resource]
default_font = ExtResource( 1 )
GridContainer/constants/hseparation = 0
GridContainer/constants/vseparation = 0

View file

@ -0,0 +1,12 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://Assets/Graphics/Palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 1, 0.537255, 0, 1 )

View file

@ -0,0 +1,12 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://Assets/Graphics/Palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 0, 0, 0, 1 )

View file

@ -0,0 +1,12 @@
[gd_resource type="StyleBoxTexture" load_steps=2 format=2]
[ext_resource path="res://Assets/Graphics/Palette/palette_button.png" type="Texture" id=1]
[resource]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 8, 8 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
modulate_color = Color( 1, 0, 0, 1 )