Fix cameras on difficulty creation

This commit is contained in:
lunarcleint
2024-02-02 16:03:33 -07:00
parent 5d3671c5e6
commit 3eb2c0df51
6 changed files with 38 additions and 3 deletions
+3 -3
View File
@@ -1,3 +1,3 @@
function update(elapsed)
if (FlxG.keys.justPressed.F5)
FlxG.resetState();
//
function update(elapsed:Float)
if (FlxG.keys.justPressed.F5) FlxG.resetState();
+17
View File
@@ -0,0 +1,17 @@
#pragma header
// Used in difficulty screen
uniform vec4 clipRect;
bool boxCollision(vec2 pixel, vec4 rect) {
return (pixel.x >= rect.x) && (pixel.x < rect.x + rect.z) && (pixel.y >= rect.y) && (pixel.y < rect.y + rect.w);
}
void main()
{
vec2 pixel = gl_FragCoord.xy;
if (boxCollision(pixel, clipRect)) gl_FragColor = flixel_texture2D(bitmap, openfl_TextureCoordv.xy);
else gl_FragColor = vec4(0.);
}
+2
View File
@@ -1,5 +1,7 @@
#pragma header
// Used in colorwheel
vec3 hsvToRgb(vec3 c) { //hsv.x = hue, hsv.y = saturation, hsv.z = value
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+2
View File
@@ -1,6 +1,8 @@
#pragma header
#define PI 3.14159265359
// Used for editors
int steps = 16;
int stepsInside = 2;
float strength = 0.0075;
@@ -1,5 +1,7 @@
#pragma header
// Used for editors (faster)
//#define iResolution _camSize
#define getTexture textureCam
@@ -1,5 +1,7 @@
package funkin.editors.charter;
import funkin.backend.shaders.CustomShader;
import flixel.math.FlxRect;
import funkin.game.Character;
import funkin.game.Stage;
import funkin.game.HealthIcon;
@@ -159,6 +161,8 @@ class StrumLineButton extends UIButton {
public var labels:Map<UISprite, UIText> = [];
public var XYComma:UIText;
public var cameraClipShader:CustomShader;
public function new(id:Int, strumLine:ChartStrumLine, parent:UIButtonList<StrumLineButton>) {
super(0, 0, '', function () {}, 620, 246);
@@ -178,6 +182,10 @@ class StrumLineButton extends UIButton {
members.push(charactersList);
idText = addLabelOn(charactersList, 'Strumline - #$id');
cameraClipShader = new CustomShader("engine/cameraClip");
cameraClipShader.hset("clipRect", [0, 0, 100, 100]);
charactersList.buttonCameras.addShader(cameraClipShader);
typeDropdown = new UIDropDown(charactersList.x + charactersList.bWidth + 16, 8+26, 200, 32, ["OPPONENT", "PLAYER", "ADDITIONAL"], strumLine.type);
members.push(typeDropdown);
addLabelOn(typeDropdown, "Type");
@@ -256,6 +264,10 @@ class StrumLineButton extends UIButton {
XYComma.follow(hudXStepper, 84 - 32, 9);
for (ui => text in labels)
text.follow(ui, 0, -24);
var subState:ChartCreationScreen = cast FlxG.state.subState;
var strumLineList:UIButtonList<StrumLineButton> = subState.strumLineList;
cameraClipShader.hset("clipRect", [0, (-y-(8+26))+cameras[0].scroll.y, strumLineList.bWidth, strumLineList.bHeight]);
}
}