Include mouse click detection

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent 27385261cb
commit 535348d317
  1. 3
      Java/scripts/build.sh
  2. 3
      Java/scripts/jar.sh
  3. 5
      Java/scripts/md5
  4. 2
      Java/scripts/version_info
  5. BIN
      bin/RabiClone.jar
  6. 53
      src/sig/engine/Panel.java
  7. 8
      src/sig/engine/Sprite.java
  8. 2
      utils/main.sh
  9. 4
      utils/md5
  10. 2
      utils/search.sh

@ -1,7 +1,8 @@
#Builds and runs the project.
#Java
source ${LANGUAGE}/scripts/version_info
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"
ORIGINAL_LOC=$(pwd)
cd $OUT_DIR

@ -1,7 +1,8 @@
#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
#Java
source ${LANGUAGE}/scripts/version_info
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"
touch manifest
echo "Main-Class: ${MAIN_CLASS}" >> manifest

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

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

Binary file not shown.

@ -10,9 +10,11 @@ import java.util.ArrayList;
import java.util.List;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.MouseInputListener;
import sig.RabiClone;
@ -34,11 +36,62 @@ public class Panel extends JPanel implements Runnable,ComponentListener {
boolean resizing=false;
long lastUpdate=System.nanoTime();
final long TARGET_FRAMETIME = 8333333l;
boolean mouseHeld=false;
java.awt.Point mousePos=new java.awt.Point(0,0);
public Panel(JFrame f) {
super(true);
this.window=f;
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
}
});
}
/**

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

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

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

@ -38,7 +38,7 @@ function check() {
if [ "$g" != "md5" ]; then
if [ -f $1$g ];
then
if [ "$g" != ".coauthors" ]; then
if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then
echo "++Redownload $1$g..."
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

Loading…
Cancel
Save