Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #79 from jeremi360/testing
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
Jeremi360 authored Jan 8, 2019
2 parents 8be1bd4 + 4dfb046 commit 4d0ed55
Show file tree
Hide file tree
Showing 22 changed files with 320 additions and 270 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ren ![Logo](window_icon.png)
# Ren ![Logo](graphics/window_icon.png)
![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg?style=flat-square)
[![Discord Server](https://img.shields.io/discord/484604562183815169.svg?style=flat-square)](https://discord.gg/K9gvjdg)
[![GitHub](https://img.shields.io/github/contributors/jeremi360/Ren.svg?style=flat-square)](https://github.com/jeremi360/Ren)
Expand All @@ -8,7 +8,7 @@
[![GitHub](https://img.shields.io/github/issues/jeremi360/Ren.svg?style=flat-square)](https://github.com/jeremi360/Ren/issues)
[![GitHub](https://img.shields.io/github/issues-closed/jeremi360/Ren.svg?style=flat-square)](https://github.com/jeremi360/Ren/issues)

Ren is framemork ( inspired by [Ren'Py](https://www.renpy.org) )
Ren is framemork (inspired by [Ren'Py](https://www.renpy.org))
<br/> for story driven games in [Godot](https://godotengine.org).

## Story driven games
Expand Down
37 changes: 33 additions & 4 deletions addons/Ren/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ var skip_types = [
StatementType.CALL_NODE
]

const weekdays={
0:'Sunday',
1:'Monday',
2:'Tuesday',
3:'Wednesday',
4:'Thrusday',
5:'Friday',
6:'Saturday'
}

const months={
1:'January',
2:'February',
3:'March',
4:'April',
5:'May',
6:'June',
7:'July',
8:'August',
9:'September',
10:'October',
11:'November',
12:'December'
}

var file = File.new()
var loading_in_progress = false
var started = false
Expand Down Expand Up @@ -131,6 +156,10 @@ func _ready():

step_timer.connect("timeout", self, "_on_time_active_timeout")

func get_datetime_str():
var d = OS.get_datetime()
return weekdays[d['weekday']] + ' ' + months[d['month']] + ' ' + str(d['day']) + ', ' + str(d['hour']) + ':' + str(d['minute'])

func _on_time_active_timeout():
active = true

Expand Down Expand Up @@ -566,23 +595,23 @@ func current_statement_in_global_history():
var r = true
var i = 0
var hi_item = current_statement.get_as_history_item()
prints(hi_item)
# prints(hi_item)

if not current_statement.kwargs.add_to_history:
i = 1
r = true
prints("r =", str(r), "i =", str(i))
# prints("r =", str(r), "i =", str(i))
return r

if not hi_item.has("state"):
i = 2
r = true
prints("r =", str(r), "i =", str(i))
# prints("r =", str(r), "i =", str(i))
return r

i = 3
r = hi_item in global_history
prints("r =", str(r), "i =", str(i))
# prints("r =", str(r), "i =", str(i))
return r

func can_auto():
Expand Down
2 changes: 2 additions & 0 deletions addons/Ren/nodes/ren_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ func _on_statement(type, kwargs):

get_parent().show()

func _on_Hide_toggled(button_pressed):
visible = !button_pressed
15 changes: 11 additions & 4 deletions addons/Ren/nodes/ren_say_panel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ func _ready():
connect("gui_input", self, "_on_adv_gui_input")
Ren.connect("exec_statement", self, "_on_statement")

func _input(event):
if not event.is_action_pressed("ren_forward"):
func _input(event):
if not event.is_action_pressed("ui_accept"):
return

if not visible:
visible = true
return

if not Ren.active:
Expand Down Expand Up @@ -82,7 +86,7 @@ func write_dialog(text, speed):
DialogText.bbcode_text = ""

var te = ""
Ren.dialog_timer.wait_time = speed
Ren.dialog_timer.wait_time = speed/100 * Ren.auto_timer.wait_time

var markup = false
for letter in text:
Expand Down Expand Up @@ -115,6 +119,9 @@ func _on_adv_gui_input(ev):

if ev.button_index == BUTTON_LEFT:
var event = InputEventAction.new()
event.action = "ren_forward"
event.action = "ui_accept"
event.pressed = true
Input.parse_input_event(event)

func _on_Hide_toggled(button_pressed):
visible = !button_pressed
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
21 changes: 17 additions & 4 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ config_version=3

config/name="Ren"
run/main_scene="res://scenes/examples/Test/Test.tscn"
boot_splash/image="res://splash.png"
config/icon="res://window_icon.png"
boot_splash/image="res://graphics/splash.png"
config/icon="res://graphics/window_icon.png"

[autoload]

Expand All @@ -28,8 +28,21 @@ enabled=PoolStringArray( "PersistenceNode", "Ren" )

[input]

ren_forward=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
ui_select=[ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":72,"unicode":0,"echo":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":3,"pressed":false,"doubleclick":false,"script":null)
]
ui_cancel=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
ren_screenshot=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
ren_fullscreen=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null)
]
ren_qsave=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777249,"unicode":0,"echo":false,"script":null)
]
ren_qload=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777250,"unicode":0,"echo":false,"script":null)
]

[rendering]
Expand Down
3 changes: 2 additions & 1 deletion scenes/examples/Test/RenAvatar.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://window_icon.png" type="Texture" id=1]
[ext_resource path="res://graphics/window_icon.png" type="Texture" id=1]


[node name="RenAvatar" type="Sprite"]

Expand Down
4 changes: 2 additions & 2 deletions scenes/examples/Test/Test.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
[ext_resource path="res://scenes/examples/Test/RenAvatar.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/Ren/nodes/ren_node2d.gd" type="Script" id=5]
[ext_resource path="res://addons/Ren/icons/ren_node2d.svg" type="Texture" id=6]
[ext_resource path="res://logo.svg" type="Texture" id=7]
[ext_resource path="res://graphics/logo.svg" type="Texture" id=7]
[ext_resource path="res://addons/Ren/nodes/ren_anim_player.gd" type="Script" id=8]
[ext_resource path="res://addons/Ren/icons/ren_anim_player.svg" type="Texture" id=9]
[ext_resource path="res://scenes/examples/Test/bell-counter-a.wav" type="AudioStream" id=10]
[ext_resource path="res://addons/Ren/nodes/ren_audio_player.gd" type="Script" id=11]
[ext_resource path="res://addons/Ren/icons/ren_audio_player.svg" type="Texture" id=12]
[ext_resource path="res://scenes/examples/Test/Welcome_in_the_intox.ogg" type="AudioStream" id=13]
[ext_resource path="res://window_icon.png" type="Texture" id=14]
[ext_resource path="res://graphics/window_icon.png" type="Texture" id=14]
[ext_resource path="res://scenes/examples/Test/TestNode.gd" type="Script" id=15]

[sub_resource type="Animation" id=1]
Expand Down
85 changes: 57 additions & 28 deletions scenes/gui/InGame/InGameGUI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ _sections_unfolded = [ "Anchor", "Mouse", "Rect", "Size Flags", "Theme", "Visibi

[node name="Notify" type="Panel" parent="." index="3"]

editor/display_folded = true
visible = false
anchor_left = 0.0
anchor_top = 0.0
Expand Down Expand Up @@ -581,26 +582,49 @@ __meta__ = {
"_edit_group_": true
}

[node name="History" parent="Quick" index="0" instance=ExtResource( 8 )]
[node name="Hide" type="CheckButton" parent="Quick" index="0"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 127.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = true
enabled_focus_mode = 0
shortcut = null
group = null
text = "Hide"
flat = false
align = 0

[node name="History" parent="Quick" index="1" instance=ExtResource( 8 )]

margin_right = 107.0
margin_left = 131.0
margin_right = 221.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "History"

[node name="Quests" parent="Quick" index="1" instance=ExtResource( 8 )]
[node name="Quests" parent="Quick" index="2" instance=ExtResource( 8 )]

margin_left = 111.0
margin_right = 218.0
margin_left = 225.0
margin_right = 315.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Quests"

[node name="Skip" type="CheckButton" parent="Quick" index="2"]
[node name="Skip" type="CheckButton" parent="Quick" index="3"]

visible = false
anchor_left = 0.0
Expand All @@ -624,14 +648,14 @@ text = "Skip"
flat = false
align = 0

[node name="Auto" type="CheckButton" parent="Quick" index="3"]
[node name="Auto" type="CheckButton" parent="Quick" index="4"]

anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 222.0
margin_right = 352.0
margin_left = 319.0
margin_right = 449.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
Expand All @@ -647,69 +671,68 @@ text = "Auto"
flat = false
align = 0

[node name="Save" parent="Quick" index="4" instance=ExtResource( 8 )]
[node name="Save" parent="Quick" index="5" instance=ExtResource( 8 )]

margin_left = 356.0
margin_right = 463.0
margin_left = 453.0
margin_right = 543.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Save"

[node name="Load" parent="Quick" index="5" instance=ExtResource( 8 )]
[node name="Load" parent="Quick" index="6" instance=ExtResource( 8 )]

margin_left = 467.0
margin_right = 574.0
margin_left = 547.0
margin_right = 637.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Load"

[node name="QSave" parent="Quick" index="6" instance=ExtResource( 8 )]
[node name="QSave" parent="Quick" index="7" instance=ExtResource( 8 )]

margin_left = 578.0
margin_right = 685.0
margin_left = 641.0
margin_right = 731.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Q. Save"

[node name="QLoad" parent="Quick" index="7" instance=ExtResource( 8 )]
[node name="QLoad" parent="Quick" index="8" instance=ExtResource( 8 )]

margin_left = 689.0
margin_right = 796.0
margin_left = 735.0
margin_right = 825.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Q. Load"

[node name="Options" parent="Quick" index="8" instance=ExtResource( 8 )]
[node name="Options" parent="Quick" index="9" instance=ExtResource( 8 )]

margin_left = 800.0
margin_right = 907.0
margin_left = 829.0
margin_right = 924.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Options"

[node name="Quit" parent="Quick" index="9" instance=ExtResource( 8 )]
[node name="Quit" parent="Quick" index="10" instance=ExtResource( 8 )]

margin_left = 911.0
margin_left = 928.0
margin_right = 1024.0
margin_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 1 )
text = "Quit"

[node name="InfoAnim" type="AnimationPlayer" parent="Quick" index="10"]
[node name="InfoAnim" type="AnimationPlayer" parent="Quick" index="11"]

editor/display_folded = true
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
Expand Down Expand Up @@ -761,4 +784,10 @@ bbcode_text = "Game was saved"
text = "Game was saved"
_sections_unfolded = [ "BBCode", "Rect", "Visibility", "custom_colors", "custom_fonts" ]

[connection signal="toggled" from="Quick/Hide" to="ScrollContainerVMenu/RenVMenu" method="_on_Hide_toggled"]

[connection signal="toggled" from="Quick/Hide" to="ScrollContainerHMenu/RenHMenu" method="_on_Hide_toggled"]

[connection signal="toggled" from="Quick/Hide" to="SayPanel" method="_on_Hide_toggled"]


4 changes: 0 additions & 4 deletions scenes/gui/InGame/Notify.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ extends Panel

func _ready():
Ren.connect("exec_statement", self, "_on_statement")
# $Timer.connect("timeout", self, "hide")
Ren.notify_timer.connect("timeout", self, "hide")

func _on_statement(type, kwargs):
if type == Ren.StatementType.NOTIFY:
$Dialog.bbcode_text = kwargs.info
# if kwargs.has("length"):
# $Timer.wait_time = kwargs.length
# $Timer.start()
show()
Ren.notified()

Expand Down
Loading

0 comments on commit 4d0ed55

Please sign in to comment.