Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ body:
validations:
required: false

- type: input
id: resolution
attributes:
label: Game resolution
placeholder: e.g. 1920x1080
description: >
If you report a problem from within the game, this will have been filled automatically with the current resolution.

You can change this if you are reporting a problem you saw in a different resolution.
Comment on lines +29 to +31

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good explanation!

validations:
required: false

- type: input
id: scene
attributes:
Expand All @@ -35,6 +47,19 @@ body:
validations:
required: false

- type: input
id: location
attributes:
label: Player location (X,Y)
placeholder: e.g. 0,0
description: >
Provide the player's coordinates in the format `X,Y` (integers only, no spaces). If reporting from within the game,
this will have been filled automatically with the player's current location.

Leave blank if location is irrelevant to the issue.
Comment on lines +56 to +59

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too, nice explanation!

validations:
required: false

- type: textarea
id: about
attributes:
Expand Down
14 changes: 14 additions & 0 deletions scenes/globals/pause/report_bug_button.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,18 @@ func _on_pressed() -> void:
if current_scene:
url += "&scene=" + current_scene.scene_file_path.uri_encode()

var game_resolution := DisplayServer.window_get_size()
if game_resolution:
url += "&resolution=" + ("%sx%s" % [game_resolution.x, game_resolution.y])

var player := get_tree().get_first_node_in_group("player")
if player:
url += (
"&location="
+ (
("%s,%s" % [player.get_global_position().x, player.get_global_position().y])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the player.global_position property instead of player.get_global_position().

Also why is this Vector2 being encoded with uri_encode(), and the game_resolution (which is also a Vector2) isn't? I would expect either both be encoded, or none. I think both should be encoded for safety.

Also you are doing custom formatting on each, the resolution Vector2 has a x separator, and the global position Vector2 has a , separator. I think it will be better if both have the same formatting, for parsing them in the future. What about using the default formatting? calling str(vector) outputs: "(100.5, 21)" if vector = Vector2(100.5, 21.0).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason it is being url encoded is to do with the format. currently game_resolution only ever returns integers separated by an x separator. therefore no url encoding is necessary.
It was formatted this way to be more readable but maybe I was just trying to be too clever.

The format of player_location however contains a , separator so I thought it would be necessary to url encode() this to avoid problems with the url string,

I can see how this might be confusing though.

I'll amend to use default formatting as suggested.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, consider that at one point we will want to decode them. So is easier to do the same for both. Something like:

	prints("&resolution=" + str(Vector2(1920, 1080)).uri_encode())
	prints(("&resolution=" + str(Vector2(1920, 1080)).uri_encode()).uri_decode())

Which outputs:

&resolution=%281920.0%2C%201080.0%29
&resolution=(1920.0, 1080.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BFoster-BF actually, after reading some more it looks like it's better to use str_to_var and var_to_str.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BFoster-BF use this for encoding:

	var s := "&resolution=" + var_to_str(Vector2(1920, 1080)).uri_encode()
	prints(s)

And we will be able to decode it like this in the future:

	var v: Vector2 = str_to_var(s.split("=")[1].uri_decode())
	prints(v)

. uri_encode()
)
)

OS.shell_open(url)
Loading