Include mouse click detection

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
Nic0Nic0Nii 2022-05-23 19:18:33 +00:00
parent 27385261cb
commit 535348d317
10 changed files with 70 additions and 12 deletions

View File

@ -1,7 +1,8 @@
#Builds and runs the project. #Builds and runs the project.
#Java #Java
source ${LANGUAGE}/scripts/version_info
rm -Rf out/* rm -Rf out/*
javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java
printf "\n\n\nRunning Program...\n\n" printf "\n\n\nRunning Program...\n\n"
ORIGINAL_LOC=$(pwd) ORIGINAL_LOC=$(pwd)
cd $OUT_DIR cd $OUT_DIR

View File

@ -1,7 +1,8 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar. #Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
#Java #Java
source ${LANGUAGE}/scripts/version_info
rm -Rf bin/* rm -Rf bin/*
javac -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp src -d bin ${PROJECT_DIR}/${PROJECT_NAME}.java
printf "\n\n\nGenerating Manifest...\n\n" printf "\n\n\nGenerating Manifest...\n\n"
touch manifest touch manifest
echo "Main-Class: ${MAIN_CLASS}" >> manifest echo "Main-Class: ${MAIN_CLASS}" >> manifest

View File

@ -1,4 +1,5 @@
build.sh:377a432ffbd63b53322d1451a214201d - build.sh:55f0208b07ba384f45009d6f92fe88fe -
clean.sh:96ce35f2d2dcb555421e00a6afda23ca - clean.sh:96ce35f2d2dcb555421e00a6afda23ca -
commit.sh:5e4448db9ad48e72ec3a1ff4f5763b41 - commit.sh:5e4448db9ad48e72ec3a1ff4f5763b41 -
jar.sh:cce5e429168700490f9c413b665d13d6 - jar.sh:56f9b7c6dc8e85f28ffefe9ce82b1f07 -
version_info:a7111b2261433c67c6cf8bfa771fe13b -

View File

@ -0,0 +1,2 @@
export SOURCE_VERSION="8"
export TARGET_VERSION="8"

BIN
bin/RabiClone.jar Normal file

Binary file not shown.

View File

@ -10,9 +10,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener; import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.MouseInputListener;
import sig.RabiClone; import sig.RabiClone;
@ -34,11 +36,62 @@ public class Panel extends JPanel implements Runnable,ComponentListener {
boolean resizing=false; boolean resizing=false;
long lastUpdate=System.nanoTime(); long lastUpdate=System.nanoTime();
final long TARGET_FRAMETIME = 8333333l; final long TARGET_FRAMETIME = 8333333l;
boolean mouseHeld=false;
java.awt.Point mousePos=new java.awt.Point(0,0);
public Panel(JFrame f) { public Panel(JFrame f) {
super(true); super(true);
this.window=f; this.window=f;
thread = new Thread(this, "MyPanel Thread"); thread = new Thread(this, "MyPanel Thread");
this.addMouseListener(new MouseInputListener(){
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
mouseHeld=true;
mousePos=e.getPoint();
System.out.println(e.getX()+","+e.getY());
System.out.println(MouseData());
}
private String MouseData() {
return new StringBuilder("Mouse Held: ").append(mouseHeld).append(" // ").append(mousePos).toString();
}
@Override
public void mouseReleased(MouseEvent e) {
mouseHeld=false;
mousePos=e.getPoint();
System.out.println(MouseData());
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseDragged(MouseEvent e) {
mousePos=e.getPoint();
System.out.println(MouseData());
}
@Override
public void mouseMoved(MouseEvent e) {
// TODO Auto-generated method stub
}
});
} }
/** /**

View File

@ -1,14 +1,14 @@
package sig.engine; package sig.engine;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
public enum Sprite{ public enum Sprite{
NANA(Path.of("..","3x.png")), NANA(new File("..","3x.png")),
; ;
@ -18,9 +18,9 @@ public enum Sprite{
int width; int width;
int[] bi_array; int[] bi_array;
Sprite(Path filename){ Sprite(File filename){
try { try {
BufferedImage img = ImageIO.read(filename.toFile()); BufferedImage img = ImageIO.read(filename);
this.width=img.getWidth(); this.width=img.getWidth();
this.height=img.getHeight(); this.height=img.getHeight();
this.bi_array = new int[width*height]; this.bi_array = new int[width*height];

View File

@ -16,7 +16,7 @@ if [ -z "$1" ]
FILES=$(ls -1A ./$LANGUAGE/scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /') FILES=$(ls -1A ./$LANGUAGE/scripts | sed -e 's/\.sh$//' | sed -e 's/^/ /')
for f in $FILES for f in $FILES
do do
if [ $f != "md5" ]; then if [ $f != "md5" ] && [ $f != "version_info" ]; then
DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)" DESC="$(head -n1 ./$LANGUAGE/scripts/$f.sh)"
printf "\n\t%-15s%-65s" $f "${DESC:1}" printf "\n\t%-15s%-65s" $f "${DESC:1}"
fi fi

View File

@ -1,5 +1,5 @@
.coauthors:67792520db231c029a208d553157044e - .coauthors:67792520db231c029a208d553157044e -
define.sh:74ea08fb12cab1053663f87007ddd29a - define.sh:74ea08fb12cab1053663f87007ddd29a -
main.sh:eacf0984141d284db6681dee4dc39ffa - main.sh:909d8d53e71c87a4b5f0f5da9fa6baa2 -
search.sh:24f4dabbe09354a0446e031ab3afe830 - search.sh:16d0a1eebbe03202019c7575d27ec3e1 -
.updateDirectories:0ede00461e947494545e694040787b3f - .updateDirectories:0ede00461e947494545e694040787b3f -

View File

@ -38,7 +38,7 @@ function check() {
if [ "$g" != "md5" ]; then if [ "$g" != "md5" ]; then
if [ -f $1$g ]; if [ -f $1$g ];
then then
if [ "$g" != ".coauthors" ]; then if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then
echo "++Redownload $1$g..." echo "++Redownload $1$g..."
if [ -f "$1$g" ]; then if [ -f "$1$g" ]; then
curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g