Add scaling width text displays.

secondmonitor
sigonasr2 4 years ago
parent bca52f69a8
commit f04b0e925f
  1. 12
      DivaBot/config.txt
  2. 4
      DivaBot/src/sig/CustomRobot.java
  3. 23
      DivaBot/src/sig/Display.java
  4. 2
      DivaBot/src/sig/DisplayManager.java
  5. 25
      DivaBot/src/sig/MyRobot.java
  6. BIN
      DivaBot/test.png

@ -1,11 +1,11 @@
DISPLAYDATA -16776961*-13369549*64*Yu Gothic UI Bold*900*90*300*Song Difficulty*24*152*~-16776961*-13369549*24*Microsoft JhengHei UI Bold*400*28*300*Overall Rating|Song Title (Romanized)|Song Title (English)*176*240*
LAST_HEIGHT 28
WIDTH 1071
DISPLAYDATA -16776961*-13369549*100*Gungsuh*300*90*300*Song Title (Japanese+Romanized+ENG)*176*152*~-16776961*-13369549*24*Gulim*400*40*300*Overall Rating|Song Title (Romanized)|FC Count*176*240*
LAST_HEIGHT 90
WIDTH 1127
HEIGHT 765
BACKGROUND -6697729
LAST_TEXT -13369549
LAST_FONT Microsoft JhengHei UI Bold
LAST_FONTSIZE 24
LAST_FONT Gungsuh
LAST_FONTSIZE 100
LAST_BACKGROUND -16776961
LAST_WIDTH 400
LAST_WIDTH 120
LAST_DELAY 300

@ -72,6 +72,10 @@ public class CustomRobot extends Robot{
return ImageUtils.toBufferedImage(currentScreen.getScaledInstance(1227, 690, BufferedImage.SCALE_AREA_AVERAGING)).getSubimage(r.x, r.y, r.width, r.height);
//return img2.getSubimage(r.x-418, r.y-204, r.width, r.height);
}
public synchronized BufferedImage createScreenCapture() {
return ImageUtils.toBufferedImage(currentScreen.getScaledInstance(1227, 690, BufferedImage.SCALE_AREA_AVERAGING));
//return img2.getSubimage(r.x-418, r.y-204, r.width, r.height);
}
public synchronized BufferedImage createScoreScreenCapture() {
return scoreCurrentScreen;
}

@ -3,13 +3,18 @@ package sig;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.util.HashMap;
import sig.utils.TextUtils;
public class Display {
Color backgroundCol=Color.BLUE;
Color textCol=Color.WHITE;
Font font=new Font("Batang",Font.PLAIN,32);
int fontSize=32;
Font modifiedfont=font;
int x;
int y;
int width=200;
@ -97,6 +102,7 @@ public class Display {
try {
while (!deleted) {
AdvanceCycle();
updateFont();
MyRobot.p.repaint();
Thread.sleep(delay);
}
@ -115,12 +121,25 @@ public class Display {
t.start();
}
public void updateFont() {
//modifiedfont
int currentSize=fontSize;
modifiedfont = font;
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(currentText, font);
while (currentSize>1&&bounds.getWidth()>width) {
currentSize-=2;
if (currentSize<=1) {break;}
modifiedfont = new Font(font.getFontName(),Font.PLAIN,currentSize);
bounds = TextUtils.calculateStringBoundsFont(currentText, modifiedfont);
}
}
public void draw(Graphics g) {
g.setColor(backgroundCol);
g.fill3DRect(x, y, width, height, true);
g.setColor(textCol);
g.setFont(font);
g.drawString(currentText,x,y+fontSize);
g.setFont(modifiedfont);
g.drawString(currentText,x,y+modifiedfont.getSize()+((height-modifiedfont.getSize())/2));
}
public String getSaveString() {

@ -144,6 +144,7 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio
try {
selectedDisplay.font=new Font(selectedDisplay.font.getFontName(),Font.PLAIN,Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength())));
selectedDisplay.fontSize=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength()));
selectedDisplay.updateFont();
MyRobot.p.repaint();
c.setBackground(Color.WHITE);
} catch (NullPointerException | NumberFormatException | BadLocationException e1) {
@ -184,6 +185,7 @@ public class DisplayManager extends JPanel implements MouseListener,ListSelectio
void updateField(JTextField c, DocumentEvent e) {
try {
selectedDisplay.width=Integer.parseInt(e.getDocument().getText(0, e.getDocument().getLength()));
selectedDisplay.updateFont();
MyRobot.p.repaint();
c.setBackground(Color.WHITE);
} catch (NullPointerException | NumberFormatException | BadLocationException e1) {

@ -92,6 +92,8 @@ public class MyRobot{
public static JFrame FRAME;
/*static String SONGNAMES[] = new String[] {"Yellow","The secret garden","Tell Your World","愛言葉","Weekender Girl","歌に形はないけれど","えれくとりっく・えんじぇぅ","神曲","カンタレラ","巨大少女","クローバー♣クラブ","恋スルVOC@LOID","桜ノ雨","39","深海シティアンダーグラウンド","深海少女","積乱雲グラフィティ","千年の独奏歌","ダブルラリアット","ハジメテノオト","初めての恋が終わる時","packaged","Palette","FREELY TOMORROW","from Y to Y","みくみくにしてあげる♪","メルト","モノクロ∞ブルースカイ","ゆめゆめ","16 -out of the gravity-","ACUTE","インタビュア","LOL -lots of laugh-","Glory 3usi9","soundless voice","ジェミニ","白い雪のプリンセスは","スキキライ","タイムマシン","Dear","DECORATOR","トリコロール・エア・ライン","Nostalogic","Hand in Hand","Fire◎Flower","ブラック★ロックシューター","メテオ","ワールドイズマイン","アマツキツネ","erase or zero","エレクトロサチュレイタ","on the rocks","からくりピエロ","カラフル×メロディ","Catch the Wave","キャットフード","サマーアイドル","shake it!","Just Be Friends","スイートマジック","SPiCa -39's Giving Day Edition-","番凩","テレカクシ思春期","天樂","どういうことなの!?","東京テディベア","どりーみんチュチュ","トリノコシティ","ネトゲ廃人シュプレヒコール","No Logic","ハイハハイニ","はじめまして地球人さん","*ハロー、プラネット。 (I.M.PLSE-EDIT)","Hello, Worker","忘却心中","magnet","右肩の蝶","結ンデ開イテ羅刹ト骸","メランコリック","リモコン","ルカルカ★ナイトフィーバー","炉心融解","WORLD'S END UMBRELLA","アカツキアライヴァル","アゲアゲアゲイン","1925","え?あぁ、そう。","エイリアンエイリアン","ODDS&ENDS","君の体温","こっち向いて Baby","壊セ壊セ","39みゅーじっく!","サンドリヨン","SING&SMILE","スノーマン","DYE","なりすましゲンガー","ヒバナ","ヒビカセ","ブラックゴールド","ミラクルペイント","指切り","ありふれたせかいせいふく","アンハッピーリフレイン","大江戸ジュリアナイト","ゴーストルール","こちら、幸福安心委員会です。","孤独の果て -extend edition-","ジターバグ","Sweet Devil","砂の惑星","テオ","初音ミクの消失 -DEAD END-","秘密警察","妄想スケッチ","リンちゃんなう!","ローリンガール","ロキ","ロミオとシンデレラ","エンヴィキャットウォーク","骸骨楽団とリリア","サイハテ","ジグソーパズル","千本桜","ピアノ×フォルテ×スキャンダル","Blackjack","ぽっぴっぽー","裏表ラバーズ","Sadistic.Music∞Factory","デンパラダイム","二次元ドリームフィーバー","ネガポジ*コンティニューズ","初音ミクの激唱","ワールズエンド・ダンスホール","ココロ","システマティック・ラヴ","Knife","二息歩行","PIANOGIRL","夢喰い白黒バク","ブレス・ユア・ブレス","恋は戦争","あなたの歌姫","Starduster","StargazeR","リンリンシグナル","Rosary Pale","多重未来のカルテット~QUARTET THEME~","LIKE THE WIND","AFTER BURNER",
"ストロボナイツ","VOiCE","恋色病棟","ねこみみスイッチ","パラジクロロベンゼン","カラフル×セクシィ","劣等上等","Star Story","パズル","キップル・インダストリー","夢の続き","MEGANE","Change me"};*/
/*static String FUTURETONESONGNAMES[] = new String[] {"Yellow","The secret garden","Tell Your World","愛言葉","Weekender Girl","歌に形はないけれど","えれくとりっく・えんじぇぅ","神曲","カンタレラ","巨大少女","クローバー♣クラブ","恋スルVOC@LOID","桜ノ雨","39","深海シティアンダーグラウンド","深海少女","積乱雲グラフィティ","千年の独奏歌","ダブルラリアット","ハジメテノオト","初めての恋が終わる時","packaged","Palette","FREELY TOMORROW","from Y to Y","みくみくにしてあげる♪","メルト","モノクロ∞ブルースカイ","ゆめゆめ","16 -out of the gravity-","ACUTE","インタビュア","LOL -lots of laugh-","Glory 3usi9","soundless voice","ジェミニ","白い雪のプリンセスは","スキキライ","タイムマシン","Dear","DECORATOR","トリコロール・エア・ライン","Nostalogic","Hand in Hand","Fire◎Flower","ブラック★ロックシューター","メテオ","ワールドイズマイン","アマツキツネ","erase or zero","エレクトロサチュレイタ","on the rocks","からくりピエロ","カラフル×メロディ","Catch the Wave","キャットフード","サマーアイドル","shake it!","Just Be Friends","スイートマジック","SPiCa -39's Giving Day Edition-","番凩","テレカクシ思春期","天樂","どういうことなの!?","東京テディベア","どりーみんチュチュ","トリノコシティ","ネトゲ廃人シュプレヒコール","No Logic","ハイハハイニ","はじめまして地球人さん","*ハロー、プラネット。 (I.M.PLSE-EDIT)","Hello, Worker","忘却心中","magnet","右肩の蝶","結ンデ開イテ羅刹ト骸","メランコリック","リモコン","ルカルカ★ナイトフィーバー","炉心融解","WORLD'S END UMBRELLA","アカツキアライヴァル","アゲアゲアゲイン","1925","え?あぁ、そう。","エイリアンエイリアン","ODDS&ENDS","君の体温","こっち向いて Baby","壊セ壊セ","39みゅーじっく!","サンドリヨン","SING&SMILE","スノーマン","DYE","なりすましゲンガー","ヒバナ","ヒビカセ","ブラックゴールド","ミラクルペイント","指切り","ありふれたせかいせいふく","アンハッピーリフレイン","大江戸ジュリアナイト","ゴーストルール","こちら、幸福安心委員会です。","孤独の果て -extend edition-","ジターバグ","Sweet Devil","砂の惑星","テオ","初音ミクの消失 -DEAD END-","秘密警察","妄想スケッチ","リンちゃんなう!","ローリンガール","ロキ","ロミオとシンデレラ","エンヴィキャットウォーク","骸骨楽団とリリア","サイハテ","ジグソーパズル","千本桜","ピアノ×フォルテ×スキャンダル","Blackjack","ぽっぴっぽー","裏表ラバーズ","Sadistic.Music∞Factory","デンパラダイム","二次元ドリームフィーバー","ネガポジ*コンティニューズ","初音ミクの激唱","ワールズエンド・ダンスホール","ココロ","システマティック・ラヴ","Knife","二息歩行","PIANOGIRL","夢喰い白黒バク","ブレス・ユア・ブレス","恋は戦争","あなたの歌姫","Starduster","StargazeR","リンリンシグナル","Rosary Pale","多重未来のカルテット~QUARTET THEME~","LIKE THE WIND","AFTER BURNER",
"ストロボナイツ","VOiCE","恋色病棟","ねこみみスイッチ","パラジクロロベンゼン","カラフル×セクシィ","劣等上等","Star Story","パズル","キップル・インダストリー","夢の続き","MEGANE","Change me"};*/
static SongInfo SONGNAMES[] = new SongInfo[] {};
static String NEWSONGS[] = new String[] {"Catch the Wave"};
int SCREEN_X;
@ -177,17 +179,6 @@ public class MyRobot{
finishbutton = ImageIO.read(new File("finish.png"));
new MyRobot().go();
}
boolean EyeTrackingIsOn() {
//1888,760
if (System.currentTimeMillis()-5000>lastReportedEyeTrackingTime) {
BufferedImage img = ImageUtils.toCompatibleImage(MYROBOT.createScreenCapture(new Rectangle(1865,760,1,1)));
Color pixel = new Color(img.getRGB(0, 0));
lastReportedEyeTrackingTime=System.currentTimeMillis();
eyeTrackingSceneOn=pixel.getRed()<60 && pixel.getGreen()<60 && pixel.getBlue()<60;
}
return eyeTrackingSceneOn;
}
boolean textFailPixel(BufferedImage img) {
Color failPixel = new Color(img.getRGB(0, 0));
@ -221,7 +212,7 @@ public class MyRobot{
Calibrator c = new Calibrator();
}
} else {
//ImageIO.write(MYROBOT.currentScreen,"png",new File("test.png"));
//ImageIO.write(MYROBOT.createScreenCapture(),"png",new File("testscreen2.png"));
if (checkSongSelect()) {
if (!overlayHidden) {
overlayHidden=true;
@ -773,9 +764,13 @@ public class MyRobot{
if (onSongSelect) {
FUTURETONE=false;
} else
if (!onSongSelect&&(c.getRed()>=165&&c.getRed()<=185&&c.getGreen()<=10&&c.getBlue()>=185&&c.getBlue()<=200)) {
FUTURETONE=true;
onSongSelect=true;
{
c = new Color(MYROBOT.createScreenCapture(new Rectangle(743,173,1,1)).getRGB(0, 0));
if (!onSongSelect&&(c.getRed()>=165&&c.getRed()<=185&&c.getGreen()<=10&&c.getBlue()>=185&&c.getBlue()<=200)) {
FUTURETONE=true;
onSongSelect=true;
}
System.out.println(c);
}
//System.out.println(onSongSelect+"/"+c);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save