This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
2,275 additions
and
1,225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/com/kamesuta/mc/bnnwidget/component/FunnyButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.kamesuta.mc.bnnwidget.component; | ||
|
||
import static org.lwjgl.opengl.GL11.*; | ||
|
||
import com.kamesuta.mc.bnnwidget.WEvent; | ||
import com.kamesuta.mc.bnnwidget.motion.Easings; | ||
import com.kamesuta.mc.bnnwidget.motion.MCoord; | ||
import com.kamesuta.mc.bnnwidget.position.Area; | ||
import com.kamesuta.mc.bnnwidget.position.Point; | ||
import com.kamesuta.mc.bnnwidget.position.R; | ||
|
||
public class FunnyButton extends MButton { | ||
public FunnyButton(final R position, final String text) { | ||
super(position, text); | ||
} | ||
|
||
boolean hover; | ||
MCoord m = new MCoord(0); | ||
MCoord s = new MCoord(1); | ||
|
||
protected void state(final boolean b) { | ||
if (b) { | ||
if (!this.hover) { | ||
this.hover = true; | ||
this.m.stop().add(Easings.easeOutElastic.move(.5f, 6f)).start(); | ||
this.s.stop().add(Easings.easeOutElastic.move(.5f, 1.1f)).start(); | ||
} | ||
} else { | ||
if (this.hover) { | ||
this.hover = false; | ||
this.m.stop().add(Easings.easeOutElastic.move(.5f, 0f)).start(); | ||
this.s.stop().add(Easings.easeOutElastic.move(.5f, 1f)).start(); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void draw(final WEvent ev, final Area pgp, final Point p, final float frame) { | ||
final Area a = getGuiPosition(pgp); | ||
glPushMatrix(); | ||
glTranslatef(a.x1()+a.w()/2, a.y1()+a.h()/2, 0); | ||
final float c = this.s.get(); | ||
glScalef(c, c, 1f); | ||
glRotatef(this.m.get(), 0, 0, 1); | ||
glTranslatef(-a.x1()-a.w()/2, -a.y1()-a.h()/2, 0); | ||
super.draw(ev, pgp, p, frame); | ||
glPopMatrix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.