Skip to content

Commit

Permalink
template copy buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
omicronrex committed Apr 21, 2024
1 parent 33f179d commit 5501b66
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 8 deletions.
3 changes: 3 additions & 0 deletions anvil/scripts/button_actions.gml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ switch (action) {

case "saveas": {save_as()} break

case "tempv": {copy_vs()} break
case "tempp": {copy_ps()} break

case "copy uniform": {clipboard_set_text(copy_uniforms())} break
case "copy base64": {clipboard_set_text(pack_shader())} break

Expand Down
20 changes: 20 additions & 0 deletions anvil/scripts/copy_ps.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
clipboard_set_text("struct PS_INPUT {
float2 texcoord: TEXCOORD0;
float4 color: COLOR0;
};
struct PS_OUTPUT {
float4 color: COLOR0;
};
SamplerState rSampler: register(s0);
PS_OUTPUT main(PS_INPUT input) {
PS_OUTPUT output;
float4 albedo = tex2D(rSampler, input.texcoord);
output.color = albedo * input.color;
return output;
}")
23 changes: 23 additions & 0 deletions anvil/scripts/copy_vs.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
clipboard_set_text("struct VS_INPUT {
float4 position: POSITION0;
float2 texcoord: TEXCOORD0;
float4 color: COLOR0;
};
struct VS_OUTPUT {
float4 position: POSITION0;
float2 texcoord: TEXCOORD0;
float4 color: COLOR0;
};
matrix rMatrixWVP;
VS_OUTPUT main(VS_INPUT input) {
VS_OUTPUT output;
output.position = mul(rMatrixWVP, input.position);
output.texcoord = input.texcoord;
output.color = input.color;
return output;
}")
23 changes: 18 additions & 5 deletions anvil/scripts/createui.gml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,28 @@ i.alt="Compile the shader and save the binary next to the source file (or in the

i=instance_create(232,328,Button)
i.w=224
i.action="saveas"
i.text="Save as..."
i.alt="Change the save location for the compiled shader"


i=instance_create(464,328,Button)
i.w=224
i.action="copy intermediate"
i.text="Copy transpiled HLSL"
i.alt="Copies the intermediate HLSL shader#created by Angle while transpiling GLSL#(when compiling Studio or Shadertoy shaders)"

i=instance_create(464,328,Button)
i.w=224
i.action="saveas"
i.text="Save as..."
i.alt="Change the save location for the compiled shader"
i=instance_create(464,360,Button)
i.w=112
i.action="tempv"
i.text="Template V"
i.alt="Copy a Vertex Shader template"

i=instance_create(576,360,Button)
i.w=112
i.action="tempp"
i.text="Template P"
i.alt="Copy a Pixel Shader template"


i=instance_create(0,400,TextArea)
Expand Down
3 changes: 0 additions & 3 deletions anvil/scripts/drawui.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ var width,width2;
width=0
width2=0

MOUSE_X=window_mouse_get_x()
MOUSE_Y=window_mouse_get_y()

draw_clear(global.col_main)

TTY=0
Expand Down
2 changes: 2 additions & 0 deletions anvil/scripts/index.yyd
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ save_as
cli_compile
textarea_get
clipboard_cleanup
copy_ps
copy_vs
2 changes: 2 additions & 0 deletions anvil/scripts/tree.yyd
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@
|createui
|drawui
|update_window
|copy_ps
|copy_vs

0 comments on commit 5501b66

Please sign in to comment.