Skip to content

Commit

Permalink
feat: add change pen color parameters to syntax and block definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
aspizu committed Jan 21, 2025
1 parent 31ac244 commit 13b2dfe
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion editors/code/syntaxes/goboscript.tmGrammar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ patterns:
- name: keyword
match: "\\b(error|warn|breakpoint|local|not|and|or|in|length|round|abs|floor|ceil|sqrt|sin|cos|tan|asin|acos|atan|ln|log|antiln|antilog)\\b"
- name: support.function.builtin
match: "\\b(move|turn_left|turn_right|goto_random_position|goto_mouse_pointer|goto|glide|glide_to_random_position|glide_to_mouse_pointer|point_in_direction|point_towards_mouse_pointer|point_towards_random_direction|point_towards|change_x|set_x|change_y|set_y|if_on_edge_bounce|set_rotation_style_left_right|set_rotation_style_do_not_rotate|set_rotation_style_all_around|say|think|switch_costume|next_costume|switch_backdrop|next_backdrop|set_size|change_size|change_color_effect|change_fisheye_effect|change_whirl_effect|change_pixelate_effect|change_mosaic_effect|change_brightness_effect|change_ghost_effect|set_color_effect|set_fisheye_effect|set_whirl_effect|set_pixelate_effect|set_mosaic_effect|set_brightness_effect|set_ghost_effect|clear_graphic_effects|show|hide|goto_front|goto_back|go_forward|go_backward|play_sound_until_done|start_sound|stop_all_sounds|change_pitch_effect|change_pan_effect|set_pitch_effect|set_pan_effect|change_volume|set_volume|clear_sound_effects|broadcast|broadcast_and_wait|wait|wait_until|stop_all|stop_this_script|stop_other_scripts|delete_this_clone|clone|ask|set_drag_mode_draggable|set_drag_mode_not_draggable|reset_timer|erase_all|stamp|pen_down|pen_up|set_pen_color|change_pen_size|set_pen_size|set_pen_hue|set_pen_saturation|set_pen_brightness|set_pen_transparency|rest|set_tempo|change_tempo)\\b"
match: "\\b(move|turn_left|turn_right|goto_random_position|goto_mouse_pointer|goto|glide|glide_to_random_position|glide_to_mouse_pointer|point_in_direction|point_towards_mouse_pointer|point_towards_random_direction|point_towards|change_x|set_x|change_y|set_y|if_on_edge_bounce|set_rotation_style_left_right|set_rotation_style_do_not_rotate|set_rotation_style_all_around|say|think|switch_costume|next_costume|switch_backdrop|next_backdrop|set_size|change_size|change_color_effect|change_fisheye_effect|change_whirl_effect|change_pixelate_effect|change_mosaic_effect|change_brightness_effect|change_ghost_effect|set_color_effect|set_fisheye_effect|set_whirl_effect|set_pixelate_effect|set_mosaic_effect|set_brightness_effect|set_ghost_effect|clear_graphic_effects|show|hide|goto_front|goto_back|go_forward|go_backward|play_sound_until_done|start_sound|stop_all_sounds|change_pitch_effect|change_pan_effect|set_pitch_effect|set_pan_effect|change_volume|set_volume|clear_sound_effects|broadcast|broadcast_and_wait|wait|wait_until|stop_all|stop_this_script|stop_other_scripts|delete_this_clone|clone|ask|set_drag_mode_draggable|set_drag_mode_not_draggable|reset_timer|erase_all|stamp|pen_down|pen_up|set_pen_color|change_pen_size|set_pen_size|set_pen_hue|set_pen_saturation|set_pen_brightness|set_pen_transparency|change_pen_hue|change_pen_saturation|change_pen_brightness|change_pen_transparency|rest|set_tempo|change_tempo)\\b"
- name: entity.name.type
match: "\\b(x_position|y_position|direction|size|costume_number|costume_name|backdrop_number|backdrop_name|volume|touching_mouse_pointer|touching_edge|touching|key_pressed|mouse_down|mouse_x|mouse_y|loudness|timer|current_year|current_month|current_date|current_day_of_week|current_hour|current_minute|current_second|days_since_2000|username|touching_color|color_is_touching_color|answer|random)\\b"
- name: punctuation
Expand Down
4 changes: 4 additions & 0 deletions gdsl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ set_pen_hue setPenColorParamTo VALUE |
set_pen_saturation setPenColorParamTo VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=saturation
set_pen_brightness setPenColorParamTo VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=brightness
set_pen_transparency setPenColorParamTo VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=transparency
change_pen_hue changePenColorParamBy VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=color
change_pen_saturation changePenColorParamBy VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=saturation
change_pen_brightness changePenColorParamBy VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=brightness
change_pen_transparency changePenColorParamBy VALUE | | COLOR_PARAM@colorParam:pen_menu_colorParam=transparency
[music]==========================================================|==========================|
rest restForBeats BEATS | |
set_tempo setTempo TEMPO | |
Expand Down
52 changes: 52 additions & 0 deletions src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ pub enum Block {
SetPenSaturation,
SetPenBrightness,
SetPenTransparency,
ChangePenHue,
ChangePenSaturation,
ChangePenBrightness,
ChangePenTransparency,
Rest,
SetTempo,
ChangeTempo,
Expand Down Expand Up @@ -389,6 +393,30 @@ impl Block {
field: "colorParam",
default: "transparency",
}),
Self::ChangePenHue => Some(Menu {
opcode: "pen_menu_colorParam",
input: "COLOR_PARAM",
field: "colorParam",
default: "color",
}),
Self::ChangePenSaturation => Some(Menu {
opcode: "pen_menu_colorParam",
input: "COLOR_PARAM",
field: "colorParam",
default: "saturation",
}),
Self::ChangePenBrightness => Some(Menu {
opcode: "pen_menu_colorParam",
input: "COLOR_PARAM",
field: "colorParam",
default: "brightness",
}),
Self::ChangePenTransparency => Some(Menu {
opcode: "pen_menu_colorParam",
input: "COLOR_PARAM",
field: "colorParam",
default: "transparency",
}),
_ => None,
}
}
Expand Down Expand Up @@ -500,6 +528,10 @@ impl Block {
("set_pen_saturation", _) => Some(Self::SetPenSaturation),
("set_pen_brightness", _) => Some(Self::SetPenBrightness),
("set_pen_transparency", _) => Some(Self::SetPenTransparency),
("change_pen_hue", _) => Some(Self::ChangePenHue),
("change_pen_saturation", _) => Some(Self::ChangePenSaturation),
("change_pen_brightness", _) => Some(Self::ChangePenBrightness),
("change_pen_transparency", _) => Some(Self::ChangePenTransparency),
("rest", _) => Some(Self::Rest),
("set_tempo", _) => Some(Self::SetTempo),
("change_tempo", _) => Some(Self::ChangeTempo),
Expand Down Expand Up @@ -598,6 +630,10 @@ impl Block {
Self::SetPenSaturation => "set_pen_saturation",
Self::SetPenBrightness => "set_pen_brightness",
Self::SetPenTransparency => "set_pen_transparency",
Self::ChangePenHue => "change_pen_hue",
Self::ChangePenSaturation => "change_pen_saturation",
Self::ChangePenBrightness => "change_pen_brightness",
Self::ChangePenTransparency => "change_pen_transparency",
Self::Rest => "rest",
Self::SetTempo => "set_tempo",
Self::ChangeTempo => "change_tempo",
Expand Down Expand Up @@ -690,6 +726,10 @@ impl Block {
"set_pen_saturation",
"set_pen_brightness",
"set_pen_transparency",
"change_pen_hue",
"change_pen_saturation",
"change_pen_brightness",
"change_pen_transparency",
"rest",
"set_tempo",
"change_tempo",
Expand Down Expand Up @@ -787,6 +827,10 @@ impl Block {
Self::SetPenSaturation => "pen_setPenColorParamTo",
Self::SetPenBrightness => "pen_setPenColorParamTo",
Self::SetPenTransparency => "pen_setPenColorParamTo",
Self::ChangePenHue => "pen_changePenColorParamBy",
Self::ChangePenSaturation => "pen_changePenColorParamBy",
Self::ChangePenBrightness => "pen_changePenColorParamBy",
Self::ChangePenTransparency => "pen_changePenColorParamBy",
Self::Rest => "music_restForBeats",
Self::SetTempo => "music_setTempo",
Self::ChangeTempo => "music_changeTempo",
Expand Down Expand Up @@ -884,6 +928,10 @@ impl Block {
Self::SetPenSaturation => &["VALUE"],
Self::SetPenBrightness => &["VALUE"],
Self::SetPenTransparency => &["VALUE"],
Self::ChangePenHue => &["VALUE"],
Self::ChangePenSaturation => &["VALUE"],
Self::ChangePenBrightness => &["VALUE"],
Self::ChangePenTransparency => &["VALUE"],
Self::Rest => &["BEATS"],
Self::SetTempo => &["TEMPO"],
Self::ChangeTempo => &["TEMPO"],
Expand Down Expand Up @@ -983,6 +1031,10 @@ impl Block {
Self::SetPenSaturation => None,
Self::SetPenBrightness => None,
Self::SetPenTransparency => None,
Self::ChangePenHue => None,
Self::ChangePenSaturation => None,
Self::ChangePenBrightness => None,
Self::ChangePenTransparency => None,
Self::Rest => None,
Self::SetTempo => None,
Self::ChangeTempo => None,
Expand Down

0 comments on commit 13b2dfe

Please sign in to comment.