+ It's sexy and I know it
This commit is contained in:
parent
e40b919a49
commit
14ae656684
|
|
@ -69,7 +69,7 @@ public class WebDisplays {
|
|||
|
||||
//Config
|
||||
public static final double PAD_RATIO = 59.0 / 30.0;
|
||||
public String homePage = "https://google.com"; //TODO: Read from config
|
||||
public String homePage = "mod://webdisplays/main.html"; //TODO: Read from config
|
||||
public double padResX;
|
||||
public double padResY;
|
||||
private int lastPadId = 0;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
|
|||
if(scr.browser == null) {
|
||||
scr.browser = ((ClientProxy) WebDisplays.PROXY).getMCEF().createBrowser(scr.url);
|
||||
scr.browser.resize(scr.resolution.x, scr.resolution.y);
|
||||
scr.doTurnOnAnim = true;
|
||||
scr.turnOnTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
tmpi.set(scr.side.right);
|
||||
|
|
@ -84,9 +86,22 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
|
|||
break;
|
||||
}
|
||||
|
||||
if(scr.doTurnOnAnim) {
|
||||
long lt = System.currentTimeMillis() - scr.turnOnTime;
|
||||
float ft = ((float) lt) / 100.0f;
|
||||
|
||||
if(ft >= 1.0f) {
|
||||
ft = 1.0f;
|
||||
scr.doTurnOnAnim = false;
|
||||
}
|
||||
|
||||
glScalef(ft, ft, 1.0f);
|
||||
}
|
||||
|
||||
float sw = ((float) scr.size.x) * 0.5f - 2.f / 16.f;
|
||||
float sh = ((float) scr.size.y) * 0.5f - 2.f / 16.f;
|
||||
|
||||
//TODO: Use tesselator
|
||||
glBindTexture(GL_TEXTURE_2D, scr.browser.getTextureID());
|
||||
glBegin(GL_QUADS);
|
||||
glColor4f(1.f, 1.f, 1.f, 1.f); glTexCoord2f(0.f, 1.f); glVertex3f(-sw, -sh, 0.505f);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ public class TileEntityScreen extends TileEntity {
|
|||
public int otherRights;
|
||||
public IBrowser browser;
|
||||
public ArrayList<ItemStack> upgrades;
|
||||
public boolean doTurnOnAnim;
|
||||
public long turnOnTime;
|
||||
|
||||
public static boolean isYouTubeURL(String url) {
|
||||
return url.matches(YT_REGEX1) || url.matches(YT_REGEX2);
|
||||
|
|
|
|||
BIN
src/main/resources/assets/webdisplays/html/front.png
Normal file
BIN
src/main/resources/assets/webdisplays/html/front.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
82
src/main/resources/assets/webdisplays/html/main.html
Normal file
82
src/main/resources/assets/webdisplays/html/main.html
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style type="text/css">
|
||||
@keyframes cube-rot {
|
||||
from { transform: rotateX(-20deg) rotateY(0); }
|
||||
to { transform: rotateX(-20deg) rotateY(360deg); }
|
||||
}
|
||||
|
||||
#centercube {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 50vh;
|
||||
transform: translateY(-50px);
|
||||
}
|
||||
|
||||
#threedee {
|
||||
perspective: 800px;
|
||||
perspective-origin: 50px 50px;
|
||||
}
|
||||
|
||||
#cube {
|
||||
position: relative;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform-style: preserve-3d;
|
||||
animation: cube-rot 2s infinite linear;
|
||||
}
|
||||
|
||||
#cube div {
|
||||
position: absolute;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url("side.png");
|
||||
}
|
||||
|
||||
#front {
|
||||
transform: translateZ(50px);
|
||||
background-image: url("front.png") !important;
|
||||
}
|
||||
|
||||
#back {
|
||||
transform: translateZ(-50px) rotateY(180deg);
|
||||
}
|
||||
|
||||
#left {
|
||||
transform: translateX(-50px) rotateY(-90deg);
|
||||
}
|
||||
|
||||
#right {
|
||||
transform: translateX(50px) rotateY(90deg);
|
||||
}
|
||||
|
||||
#top {
|
||||
transform: translateY(-50px) rotateX(-90deg);
|
||||
}
|
||||
|
||||
#wd {
|
||||
padding-left: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table id="centercube">
|
||||
<tr>
|
||||
<td id="threedee">
|
||||
<div id="cube">
|
||||
<div id="front"></div>
|
||||
<div id="back"></div>
|
||||
<div id="left"></div>
|
||||
<div id="right"></div>
|
||||
<div id="top"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td id="wd">
|
||||
<img src="webdisplays.png" />
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/main/resources/assets/webdisplays/html/side.png
Normal file
BIN
src/main/resources/assets/webdisplays/html/side.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 479 B |
BIN
src/main/resources/assets/webdisplays/html/webdisplays.png
Normal file
BIN
src/main/resources/assets/webdisplays/html/webdisplays.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
Loading…
Reference in New Issue
Block a user