Added Video Export feature with according Options in the Options Menu

Fixed Linear Interpolation
This commit is contained in:
Marius Metzger
2015-02-08 12:40:37 +01:00
parent 0fc9662449
commit 03f6ba1ade
39 changed files with 1235 additions and 456 deletions

View File

@@ -1,6 +1,7 @@
package eu.crushedpixel.replaymod.gui.online;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -14,19 +15,26 @@ import net.minecraft.client.resources.I18n;
import org.lwjgl.input.Keyboard;
import scala.actors.threadpool.Arrays;
import com.mojang.realmsclient.gui.GuiCallback;
import eu.crushedpixel.replaymod.ReplayMod;
import eu.crushedpixel.replaymod.api.client.ApiException;
import eu.crushedpixel.replaymod.api.client.holders.FileInfo;
import eu.crushedpixel.replaymod.gui.GuiConstants;
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
import eu.crushedpixel.replaymod.gui.replaymanager.GuiReplayManager;
import eu.crushedpixel.replaymod.online.authentication.AuthenticationHandler;
public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
private enum Tab {
RECENT_FILES, BEST_FILES, MY_FILES, SEARCH;
}
private GuiReplayListExtended currentList;
private ReplayFileList recentFileList, bestFileList, myFileList, searchFileList;
private Tab currentTab = Tab.RECENT_FILES;
@Override
public void initGui() {
Keyboard.enableRepeatEvents(true);
@@ -40,7 +48,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
GuiButton recentButton = new GuiButton(GuiConstants.CENTER_RECENT_BUTTON, 20, 30, "Newest Replays");
buttonBar.add(recentButton);
GuiButton bestButton = new GuiButton(GuiConstants.CENTER_BEST_BUTTON, 20, 30, "Best Replays");
buttonBar.add(bestButton);
@@ -70,7 +78,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
GuiButton exitButton = new GuiButton(GuiConstants.CENTER_BACK_BUTTON, 20, 20, "Main Menu");
bottomBar.add(exitButton);
GuiButton managerButton = new GuiButton(GuiConstants.CENTER_MANAGER_BUTTON, 20, 20, "Replay Manager");
bottomBar.add(managerButton);
@@ -91,7 +99,7 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
i++;
}
showOnlineRecent();
}
@@ -107,11 +115,11 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
} else if(button.id == GuiConstants.CENTER_RECENT_BUTTON) {
showOnlineRecent();
} else if(button.id == GuiConstants.CENTER_BEST_BUTTON) {
} else if(button.id == GuiConstants.CENTER_MY_REPLAYS_BUTTON) {
} else if(button.id == GuiConstants.CENTER_SEARCH_BUTTON) {
}
}
@@ -144,22 +152,66 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
this.drawDefaultBackground();
this.drawCenteredString(fontRendererObj, "Replay Center", this.width/2, 8, Color.WHITE.getRGB());
if(currentList != null) {
currentList.drawScreen(mouseX, mouseY, partialTicks);
}
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(currentList != null) {
this.currentList.handleMouseInput();
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if(currentList != null) {
this.currentList.mouseClicked(mouseX, mouseY, mouseButton);
}
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
if(currentList != null) {
this.currentList.mouseReleased(mouseX, mouseY, state);
}
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
public void showOnlineRecent() {
mc.addScheduledTask(new Runnable() {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
if(recentFileList == null) {
recentFileList = new ReplayFileList(mc, width, height, 50, height-40, 36);
} else {
recentFileList.clearEntries();
recentFileList.width = width;
recentFileList.height = height;
recentFileList.top = 50;
recentFileList.bottom = height-40;
}
currentTab = Tab.RECENT_FILES;
currentList = recentFileList;
FileInfo[] files = ReplayMod.apiClient.getRecentFiles();
for(FileInfo i : files) {
//TODO: Display the Files
File tmp = null;
if(i.hasThumbnail()) {
tmp = File.createTempFile("thumb_online_"+i.getId(), "jpg");
ReplayMod.apiClient.downloadThumbnail(i.getId(), tmp);
}
recentFileList.addEntry(i.getName(), i.getMetadata(), tmp);
}
} catch (IOException e) {
e.printStackTrace();
@@ -168,7 +220,8 @@ public class GuiReplayCenter extends GuiScreen implements GuiYesNoCallback {
}
}
});
t.start();
}
}

View File

@@ -0,0 +1,12 @@
package eu.crushedpixel.replaymod.gui.online;
import net.minecraft.client.Minecraft;
import eu.crushedpixel.replaymod.gui.GuiReplayListExtended;
public class ReplayFileList extends GuiReplayListExtended {
public ReplayFileList(Minecraft mcIn, int p_i45010_2_, int p_i45010_3_,
int p_i45010_4_, int p_i45010_5_, int p_i45010_6_) {
super(mcIn, p_i45010_2_, p_i45010_3_, p_i45010_4_, p_i45010_5_, p_i45010_6_);
}
}