Skip to content

Commit

Permalink
Merge pull request #1 from Mainman002/Gui_v2
Browse files Browse the repository at this point in the history
Gui v2
  • Loading branch information
Mainman002 authored Sep 10, 2019
2 parents 1054502 + 322ac39 commit 072af7a
Show file tree
Hide file tree
Showing 23 changed files with 1,004 additions and 482 deletions.
1,100 changes: 698 additions & 402 deletions Project Files/Assets/Scenes/MainMenu.tscn

Large diffs are not rendered by default.

27 changes: 19 additions & 8 deletions Project Files/Assets/Scripts/Brushes/Cursor1.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func _ready():
get_node("../CursorCenter").connect("area_exited", self, "CanvasExited")
connect("area_entered", self, "PixelEntered")
connect("area_exited", self, "PixelExited")
get_node(BrushSizeSlider).connect("value_changed", self, "_toolChanged")
get_node(Events.nodes["cursorSizeSlider"].Path).connect("value_changed", self, "_toolChanged")
# get_node(BrushSizeSlider).connect("value_changed", self, "_toolChanged")
get_node(ColorPickerNode).color = FuncManager.activeColor
FuncManager.Cursor = get_path()
FuncManager.CursorColorMask = get_path()
Expand All @@ -48,13 +49,13 @@ func _input(event):
brushSize -= 1
_set_size(brushSize, brushSize/4, brushSize/4)

if Input.is_action_just_pressed("colorPick") or FuncManager.selectedTool == "Color Eraser":
_set_size(2, .2, brushPickerSize)
if Input.is_action_pressed("colorPick") or FuncManager.selectedTool == "Color Eraser":
_set_size(null, .2, brushPickerSize)
else:
_set_size(brushSize, brushSize/4, brushSize/4)

if FuncManager.selectedTool == "Picker":
_set_size(2, .2, brushPickerSize)
_set_size(null, .2, brushPickerSize)
elif FuncManager.selectedTool == "Painter" or FuncManager.selectedTool == "Eraser":
_set_size(brushSize, brushSize/4, brushSize/4)

Expand All @@ -68,18 +69,28 @@ func _physics_process(delta):

func _toolChanged(value):
if FuncManager.panelOpen == false:
get_node(BrushSizeLabel).text = str(value)
# get_node(BrushSizeLabel).text = str(value)
if not Input.is_action_pressed("colorPick") and not FuncManager.selectedTool == "Picker" and not FuncManager.selectedTool == "Color Eraser":
brushSize = get_node(Events.nodes["cursorSizeSlider"].Path).value
# brushSize = get_node(BrushSizeSlider).value
brushSize = value
# brushSize = value
$CShape2D.shape.radius = brushSize
FuncManager.brushSize = brushSize

func _set_size(_size, _dec, _pickSize):
if FuncManager.panelOpen == false:
$CShape2D.shape.radius = _size
if _size != null:
$CShape2D.shape.radius = _size
get_node(Events.nodes["cursorSizeSlider"].Path).value = _size
# brushSize = _size
else:
$CShape2D.shape.radius = _pickSize
get_node(Events.nodes["cursorSizeSlider"].Path).value = _pickSize
# brushSize = _pickSize
$Sprite.scale = Vector2(_dec,_dec)
$ColorMask.scale = Vector2(_pickSize,_pickSize)
get_node(BrushSizeSlider).value = _size
# get_node(BrushSizeSlider).value = _size

FuncManager._brush_size_Update(_size, _dec, _pickSize)

func colorMaskUpdate(_color):
Expand Down
5 changes: 3 additions & 2 deletions Project Files/Assets/Scripts/Buttons/ColorSwap1.gd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extends ColorRect

export (int) var colNum = 1
export (NodePath) var currentColor
export (NodePath) var colorPicker
#export (NodePath) var currentColor
#export (NodePath) var colorPicker

onready var FuncManager = get_node("/root/MainMenu/FunctionController")

Expand All @@ -12,5 +12,6 @@ func _ready():
func _colorSwap():
if FuncManager.panelOpen == false:
FuncManager._color_Update(colNum, color)
get_node(Events.nodes["VirtualGrid"].Path).visible = FuncManager.grid_showing


4 changes: 4 additions & 0 deletions Project Files/Assets/Scripts/Buttons/CursorSizeSlider1.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends VSlider

func _ready():
Events._initialize_nodes_list(name, get_path())
8 changes: 4 additions & 4 deletions Project Files/Assets/Scripts/Buttons/GridAmount1.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends TextureButton
extends Button

var PixSize = 2

Expand All @@ -10,15 +10,15 @@ func _ready():
func _pressed():
if PixSize == 0:
FuncManager.pixelGrid(0, 0, 0, 0)
$Label.text = "8"
text = "8"
PixSize = 2
elif PixSize == 1:
FuncManager.pixelGrid(1, 1, 1, 1)
$Label.text = "16"
text = "16"
PixSize = 0
elif PixSize == 2:
FuncManager.pixelGrid(2, 2, 2, 2)
$Label.text = "32"
text = "32"
PixSize = 1


Expand Down
29 changes: 27 additions & 2 deletions Project Files/Assets/Scripts/Buttons/SaveImage.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ export (NodePath) var mainCam
export (NodePath) var canvasCam
export (NodePath) var fileDialog
export (NodePath) var bgColor
export (NodePath) var transparentBGColor
export (NodePath) var xWidth
export (NodePath) var yHeight
export (NodePath) var CursorSprite
export (NodePath) var Grid
#export (NodePath) var Grid
export (NodePath) var VirtualGrid
export (NodePath) var TopBar
export (NodePath) var ToolsBar
export (NodePath) var SideBar

var filePath = "user://"
var fileName
Expand Down Expand Up @@ -38,6 +42,10 @@ func _FileBroweser():

func _screenTakeImage():
get_node(bgColor).visible = false
get_node(transparentBGColor).visible = false
get_node(TopBar).visible = false
get_node(ToolsBar).visible = false
get_node(SideBar).visible = false
get_node("/root/MainMenu/FilesPanel").visible = false
if FuncManager.grid_showing == true:
# FuncManager._grid_Update()
Expand All @@ -58,6 +66,10 @@ func _screenTakeImage():
elif str2var(get_node(yHeight).text) > textureSizeLimitMax:
get_node(yHeight).text = str(textureSizeLimitMax)

# yield(get_tree(), "idle_frame")
# yield(get_tree(), "idle_frame")
# yield(get_tree(), "idle_frame")

windowMaximized = OS.window_maximized
OS.window_maximized = false

Expand All @@ -74,16 +86,25 @@ func _screenReset():
OS.window_size.x = windowSizeX
OS.window_size.y = windowSizeY
get_node(bgColor).visible = true
get_node("/root/MainMenu/FilesPanel").visible = true
get_node(transparentBGColor).visible = true
get_node(TopBar).visible = true
get_node(ToolsBar).visible = true
get_node(SideBar).visible = true
get_node("/root/MainMenu/FilesPanel").visible = false
if FuncManager.grid_showing == true:
# FuncManager._grid_Update()
get_node(VirtualGrid).visible = true
get_node(CursorSprite).visible = true
CursorCenter.visible = true

yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")

OS.window_maximized = windowMaximized

FuncManager.can_draw = true
FuncManager.panelOpen = false
# get_viewport().render_target_v_flip = false

func _CaptureScreen():
Expand All @@ -109,4 +130,8 @@ func _CaptureScreen():

tex.get_data().save_png(str(get_node(fileDialog).current_path, ".png"))
# print(str($FileDialog.current_path, ".png"))

yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
yield(get_tree(), "idle_frame")
_screenReset()
4 changes: 2 additions & 2 deletions Project Files/Assets/Scripts/Buttons/ShowPanel1.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
extends Button

export (NodePath) var PanelNode
export (String) var PanelNode = "FilesPanel"

onready var FuncManager = get_node("/root/MainMenu/FunctionController")

func _ready():
connect("pressed", self, "_showPanel")

func _showPanel():
get_node(PanelNode).visible = true
get_node(Events.nodes[PanelNode].Path).visible = true
FuncManager.panelOpen = true

4 changes: 2 additions & 2 deletions Project Files/Assets/Scripts/Buttons/ToolChangeBTN.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends TextureButton

export (String) var toolMode
export (NodePath) var toolLabel
#export (String) var toolMode
#export (NodePath) var toolLabel
export (int) var SelectedTool = 0
#export (NodePath) var Cursor
#export (int) var brushSize = 4
Expand Down
29 changes: 18 additions & 11 deletions Project Files/Assets/Scripts/Buttons/visibilityToggleBTN.gd
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
extends TextureButton

export (bool) var isVisible
export (NodePath) var VirtualGrid
export (bool) var notVisible
#export (NodePath) var VirtualGrid
#export (Texture) var sprite_normal

var visibleToggled

onready var FuncManager = get_node("/root/MainMenu/FunctionController")

func _ready():
connect("pressed", self, "_pressed")
visibleToggled = isVisible
# texture_normal = sprite_normal

yield(get_tree(), "idle_frame")
_start_Check()


func _start_Check():
pressed = notVisible
visibleToggled = notVisible
FuncManager.grid_showing = notVisible
FuncManager._grid_Update()
get_node(Events.nodes["VirtualGrid"].Path).visible = FuncManager.grid_showing

func _pressed():
if FuncManager.panelOpen == false:
pressed = FuncManager.grid_showing
FuncManager._grid_Update()
get_node(VirtualGrid).visible = FuncManager.grid_showing
# if visibleToggled == true:
# visibleToggled = false
# else:
# visibleToggled = true


# get_node(Grid).visible = FuncManager.grid_showing
get_node(Events.nodes["VirtualGrid"].Path).visible = FuncManager.grid_showing

Loading

0 comments on commit 072af7a

Please sign in to comment.