Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
quality of life shit to add swag stuff later
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Dec 18, 2023
1 parent 767fac2 commit b94fed4
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
20 changes: 18 additions & 2 deletions source/funkin/graphics/FlxSpriteExt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,27 @@ class FlxSpriteExt extends FlxSkewedSprite {
if (flippedOffsets) {
flipX = !flipX;
scale.x *= -1;
super.draw();
__superDraw();
flipX = !flipX;
scale.x *= -1;
}
else super.draw();
else __superDraw();
}

@:noCompletion
private inline function __superDraw() {
inline checkEmptyFrame();
if (alpha == 0 || _frame.type == EMPTY) return;
if (dirty) calcFrame(useFramePixels); // rarely

for (i in 0...cameras.length) {
final camera = cameras[i];
if (!camera.visible || !camera.exists || !isOnScreen(camera)) continue;
drawComplex(camera);
#if FLX_DEBUG FlxBasic.visibleCount++; #end
}

#if FLX_DEBUG if (FlxG.debugger.drawDebug) drawDebug(); #end
}

public override function getScreenBounds(?rect:FlxRect, ?cam:FlxCamera):FlxRect {
Expand Down
40 changes: 40 additions & 0 deletions source/funkin/graphics/SmartSprite.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package funkin.graphics;

enum RenderMode {
QUAD;
REPEAT;
}

class SmartSprite extends FlxRepeatSprite {
public var renderMode:RenderMode = QUAD;

public function new(?X:Float, ?Y:Float, ?SimpleGraphic:FlxGraphicAsset) {
super(X, Y, SimpleGraphic, 0, 0);
}

override function drawComplex(camera:FlxCamera) {
switch (renderMode) {
case REPEAT: super.drawComplex(camera);
case QUAD:
_frame.prepareMatrix(_matrix, ANGLE_0, checkFlipX(), checkFlipY());
_matrix.translate(-origin.x, -origin.y);
_matrix.scale(scale.x, scale.y);

if (matrixExposed) _matrix.concat(transformMatrix);
else {
if (bakedRotationAngle <= 0) {
updateTrig();
if (angle != 0) _matrix.rotateWithTrig(_cosAngle, _sinAngle);
}
updateSkewMatrix();
_matrix.concat(_skewMatrix);
}

getScreenPosition(_point, camera).subtractPoint(offset);
_point.addPoint(origin);
_matrix.translate(_point.x, _point.y);
camera.drawPixels(_frame, framePixels, _matrix, colorTransform, blend, antialiasing, shader);
}

}
}
10 changes: 10 additions & 0 deletions source/funkin/objects/note/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ interface INoteData {
public var noteData:Int;
}

interface INoteObject extends INoteData {
public var strumTime:Float;
public var noteSpeed:Float;
public var targetStrum:NoteStrum;
public var parentNote:Note;
public var childNote:Sustain;

public var isSustainNote:Bool;
}

class Note extends FlxSpriteExt implements INoteData {
public var noteData:Int = 0;
public var strumTime:Float = 0;
Expand Down
1 change: 1 addition & 0 deletions source/funkin/objects/note/Sustain.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import funkin.graphics.FlxRepeatSprite;

class Sustain extends FlxRepeatSprite implements INoteData {
public var noteData:Int = 0;
public var noteSpeed:Float = 1.0;

public function new(noteData:Int = 0) {
super();
Expand Down

0 comments on commit b94fed4

Please sign in to comment.