mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-08 02:29:30 +00:00
Fixed script editor funky UI issues
This commit is contained in:
parent
73211ae242
commit
e43ddccb56
|
@ -14,6 +14,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -73,7 +74,7 @@ public class SpellChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Suggestion> getSuggestions(String word) {
|
private Set<Suggestion> getSuggestions(String word) {
|
||||||
TreeSet<Suggestion> suggestions = new TreeSet<>();
|
Set<Suggestion> suggestions = Collections.synchronizedSet(new TreeSet<>());
|
||||||
if (word == null || word.isEmpty()) {
|
if (word == null || word.isEmpty()) {
|
||||||
return suggestions;
|
return suggestions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ public class MythosScriptEditorController
|
||||||
mythos = (JSObject) editorView.getEngine().executeScript("Mythos");
|
mythos = (JSObject) editorView.getEngine().executeScript("Mythos");
|
||||||
mythos.setMember("editor", editor);
|
mythos.setMember("editor", editor);
|
||||||
editorView.getEngine().executeScript(loadScript);
|
editorView.getEngine().executeScript(loadScript);
|
||||||
|
editorView.getEngine().executeScript("window.dispatchEvent(new Event('resize'));");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,19 @@
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#blocklyArea {
|
#blocklyArea {
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
#blocklyDiv {
|
#blocklyDiv {
|
||||||
height: 700px;
|
height: 700px;
|
||||||
width: 996px;
|
width: 990px;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
12
Platform/Apple/tools/AppPackaging/update_builds.sh
Normal file
12
Platform/Apple/tools/AppPackaging/update_builds.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
mkdir -p /tmp/ll/Lawless\ Legends
|
||||||
|
cd /tmp/ll
|
||||||
|
cp /Users/brobert/Dropbox/Lawless\ Legends/Lawless\ Legends\ Manual\ v5\ 20210217.txt .
|
||||||
|
cp /Users/brobert/Documents/code/lawless-legends/Platform/Apple/tools/jace/target/*jar ./Lawless\ Legends
|
||||||
|
zip -rv /Users/brobert/Dropbox/Lawless\ Legends/Lawless\ Legends-win64.zip .
|
||||||
|
rm -rf ./Lawless\ Legends
|
||||||
|
|
||||||
|
mkdir -p /tmp/ll/Lawless\ Legends.app/Contents/Resources
|
||||||
|
cp /Users/brobert/Documents/code/lawless-legends/Platform/Apple/tools/jace/target/*jar ./Lawless\ Legends.app/Contents/Resources
|
||||||
|
zip -rv /Users/brobert/Dropbox/Lawless\ Legends/Lawless\ Legends-osx.zip .
|
||||||
|
cd ~
|
||||||
|
rm -rf /tmp/ll
|
8
Platform/Apple/tools/jace/.idea/.gitignore
vendored
Normal file
8
Platform/Apple/tools/jace/.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
6
Platform/Apple/tools/jace/.idea/azure/azureSettings.xml
Normal file
6
Platform/Apple/tools/jace/.idea/azure/azureSettings.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AzureSettings">
|
||||||
|
<option name="appInsights" value="rO0ABXVyAEtbTGNvbS5taWNyb3NvZnQuYXBwbGljYXRpb25pbnNpZ2h0cy5wcmVmZXJlbmNlLkFwcGxpY2F0aW9uSW5zaWdodHNSZXNvdXJjZTvCzxEP0C2HbAIAAHhwAAAAAA==" />
|
||||||
|
</component>
|
||||||
|
</project>
|
13
Platform/Apple/tools/jace/.idea/compiler.xml
Normal file
13
Platform/Apple/tools/jace/.idea/compiler.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="lawlesslegends" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
Platform/Apple/tools/jace/.idea/encodings.xml
Normal file
7
Platform/Apple/tools/jace/.idea/encodings.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
25
Platform/Apple/tools/jace/.idea/jarRepositories.xml
Normal file
25
Platform/Apple/tools/jace/.idea/jarRepositories.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="artifactory-dev-releases" />
|
||||||
|
<option name="name" value="Adobe Artifactory Repository" />
|
||||||
|
<option name="url" value="https://artifactory.corp.adobe.com/artifactory/maven-aem-dev" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
12
Platform/Apple/tools/jace/.idea/misc.xml
Normal file
12
Platform/Apple/tools/jace/.idea/misc.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
10
Platform/Apple/tools/jace/.idea/runConfigurations.xml
Normal file
10
Platform/Apple/tools/jace/.idea/runConfigurations.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RunConfigurationProducerService">
|
||||||
|
<option name="ignoredProducers">
|
||||||
|
<set>
|
||||||
|
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
Platform/Apple/tools/jace/.idea/vcs.xml
Normal file
6
Platform/Apple/tools/jace/.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,23 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.12" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.26.0-GA" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" />
|
|
||||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.eclipse.collections:eclipse-collections:10.4.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.eclipse.collections:eclipse-collections-api:10.4.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.xerial.thirdparty:nestedvm:1.0" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
package jace.lawless;
|
||||||
|
|
||||||
|
import jace.LawlessLegends;
|
||||||
|
import jace.apple2e.Apple2e;
|
||||||
|
import jace.apple2e.SoftSwitches;
|
||||||
|
import jace.core.Computer;
|
||||||
|
import jace.core.Device;
|
||||||
|
import jace.core.Motherboard;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.effect.DropShadow;
|
||||||
|
import javafx.scene.layout.Background;
|
||||||
|
import javafx.scene.layout.BackgroundFill;
|
||||||
|
import javafx.scene.layout.CornerRadii;
|
||||||
|
import javafx.scene.layout.Region;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple device that displays speed and fps stats
|
||||||
|
*/
|
||||||
|
public class FPSMonitorDevice extends Device {
|
||||||
|
public static final long UPDATE_CHECK_FREQUENCY = 1000;
|
||||||
|
Apple2e computer;
|
||||||
|
Label cpuSpeedIcon;
|
||||||
|
Label fpsIcon;
|
||||||
|
|
||||||
|
long checkCounter = 0;
|
||||||
|
long tickCounter = 0;
|
||||||
|
int frameCounter = 0;
|
||||||
|
long lastUpdate = 0;
|
||||||
|
long UPDATE_INTERVAL = 1000/2;
|
||||||
|
boolean lastVBLState = false;
|
||||||
|
|
||||||
|
public FPSMonitorDevice(Computer c) {
|
||||||
|
super(c);
|
||||||
|
computer = (Apple2e) c;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDeviceName() {
|
||||||
|
return "FPS Monitor";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
tickCounter += Math.min(Motherboard.cpuPerClock, 1);
|
||||||
|
boolean vblState = SoftSwitches.VBL.getSwitch().getState();
|
||||||
|
if (!vblState && lastVBLState) {
|
||||||
|
frameCounter++;
|
||||||
|
}
|
||||||
|
lastVBLState = vblState;
|
||||||
|
if (--checkCounter <= UPDATE_CHECK_FREQUENCY) {
|
||||||
|
updateIcon();
|
||||||
|
checkCounter = UPDATE_CHECK_FREQUENCY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label initLabel(Label l) {
|
||||||
|
l.setTextFill(Color.WHITE);
|
||||||
|
l.setEffect(new DropShadow(2.0, Color.BLACK));
|
||||||
|
l.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.8), new CornerRadii(5.0), new Insets(-5.0))));
|
||||||
|
l.setMinWidth(64.0);
|
||||||
|
l.setMaxWidth(Region.USE_PREF_SIZE);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateIcon() {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
long ellapsed = now - lastUpdate;
|
||||||
|
if (ellapsed < UPDATE_INTERVAL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cpuSpeedIcon == null) {
|
||||||
|
cpuSpeedIcon = initLabel(new Label());
|
||||||
|
fpsIcon = initLabel(new Label());
|
||||||
|
}
|
||||||
|
LawlessLegends.getApplication().controller.addIndicator(cpuSpeedIcon,1000);
|
||||||
|
LawlessLegends.getApplication().controller.addIndicator(fpsIcon,1000);
|
||||||
|
double secondsEllapsed = ((double) ellapsed) / 1000.0;
|
||||||
|
double speed = ((double) tickCounter) / secondsEllapsed / 1000000.0;
|
||||||
|
double fps = ((double) frameCounter)/secondsEllapsed;
|
||||||
|
String mhzStr = String.format("%1.1fmhz", speed);
|
||||||
|
String fpsStr = String.format("%1.1ffps", fps);
|
||||||
|
// System.out.println(mhzStr+";"+fpsStr);
|
||||||
|
Platform.runLater(()->{
|
||||||
|
cpuSpeedIcon.setText(mhzStr);
|
||||||
|
fpsIcon.setText(fpsStr);
|
||||||
|
});
|
||||||
|
// Reset counters
|
||||||
|
lastUpdate = now;
|
||||||
|
tickCounter = 0;
|
||||||
|
frameCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getShortName() {
|
||||||
|
return "fps";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reconfigure() {
|
||||||
|
tickCounter = 0;
|
||||||
|
frameCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detach() {
|
||||||
|
if (cpuSpeedIcon != null) {
|
||||||
|
LawlessLegends.getApplication().controller.removeIndicator(cpuSpeedIcon);
|
||||||
|
LawlessLegends.getApplication().controller.removeIndicator(fpsIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user