Add a second trailing display that wraps around when the song display
view is scrolling.
This commit is contained in:
parent
1deb107b39
commit
3d37343311
@ -161,10 +161,15 @@ public class DrawCanvas extends JPanel{
|
|||||||
String text = songname+" / "+((romanizedname.length()>0)?romanizedname:englishname)+" "+(artist.length()>0?"by "+artist:"")+" "+((plays>0)?("Plays - "+(passes)+"/"+(plays)):"")+" "+((plays!=0)?"("+((int)(Math.floor(((float)passes)/plays*100)))+"% pass rate"+((fcCount>0)?" - "+fcCount+" FC"+(fcCount==1?"":"s")+" "+((int)(Math.floor(((float)fcCount)/plays*100)))+"% FC rate":"")+")":"No plays")+" "+((bestPlay!=null)?"Best Play - "+bestPlay.display():"")+" Overall Rating: "+overallrating;
|
String text = songname+" / "+((romanizedname.length()>0)?romanizedname:englishname)+" "+(artist.length()>0?"by "+artist:"")+" "+((plays>0)?("Plays - "+(passes)+"/"+(plays)):"")+" "+((plays!=0)?"("+((int)(Math.floor(((float)passes)/plays*100)))+"% pass rate"+((fcCount>0)?" - "+fcCount+" FC"+(fcCount==1?"":"s")+" "+((int)(Math.floor(((float)fcCount)/plays*100)))+"% FC rate":"")+")":"No plays")+" "+((bestPlay!=null)?"Best Play - "+bestPlay.display():"")+" Overall Rating: "+overallrating;
|
||||||
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(text, programFont);
|
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(text, programFont);
|
||||||
if (scrollX<-bounds.getWidth()-100) {
|
if (scrollX<-bounds.getWidth()-100) {
|
||||||
scrollX=(int)bounds.getWidth()+100;
|
scrollX=0;
|
||||||
}
|
}
|
||||||
DrawUtils.drawOutlineText(g2, programFont, 32+scrollX, 36, 3, Color.WHITE, new Color(0,0,0,64), text);
|
DrawUtils.drawOutlineText(g2, programFont, 32+scrollX, 36, 3, Color.WHITE, new Color(0,0,0,64), text);
|
||||||
|
if (scrolling) {
|
||||||
|
DrawUtils.drawOutlineText(g2, programFont, 32+scrollX+(int)bounds.getWidth()+100, 36, 3, Color.WHITE, new Color(0,0,0,64), text);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (difficulty) {
|
switch (difficulty) {
|
||||||
case "H":{
|
case "H":{
|
||||||
g2.drawImage(hard,0,0,20,51,null);
|
g2.drawImage(hard,0,0,20,51,null);
|
||||||
|
69
DivaBot/src/sig/utils/WebUtils.java
Normal file
69
DivaBot/src/sig/utils/WebUtils.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package sig.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.HttpVersion;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
import org.apache.http.entity.mime.MultipartEntity;
|
||||||
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||||
|
import org.apache.http.entity.mime.content.ContentBody;
|
||||||
|
import org.apache.http.entity.mime.content.FileBody;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.params.CoreProtocolPNames;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
|
public class WebUtils {
|
||||||
|
public static void POSTimage(String url,File file,Map<String,String> params) {
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||||
|
HttpPost uploadFile = new HttpPost(url);
|
||||||
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
|
for (String s : params.keySet()) {
|
||||||
|
builder.addTextBody(s, params.get(s), ContentType.TEXT_PLAIN);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// This attaches the file to the POST:
|
||||||
|
builder.addBinaryBody(
|
||||||
|
"file",
|
||||||
|
new FileInputStream(file),
|
||||||
|
ContentType.APPLICATION_OCTET_STREAM,
|
||||||
|
file.getName()
|
||||||
|
);
|
||||||
|
|
||||||
|
HttpEntity multipart = builder.build();
|
||||||
|
uploadFile.setEntity(multipart);
|
||||||
|
CloseableHttpResponse response;
|
||||||
|
response = httpClient.execute(uploadFile);
|
||||||
|
HttpEntity responseEntity = response.getEntity();
|
||||||
|
String result = "";
|
||||||
|
if (responseEntity != null) {
|
||||||
|
try (InputStream instream = responseEntity.getContent()) {
|
||||||
|
Scanner s = new Scanner(instream).useDelimiter("\\A");
|
||||||
|
result = s.hasNext() ? s.next() : "";
|
||||||
|
System.out.println(result);
|
||||||
|
instream.close();
|
||||||
|
} catch (UnsupportedOperationException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user