Fix zoom, rename block functions
This commit is contained in:
parent
0aceed466d
commit
3031966145
|
@ -1,7 +1,5 @@
|
||||||
package it.cavallium.warppi;
|
package it.cavallium.warppi;
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import it.cavallium.warppi.boot.StartupArguments;
|
import it.cavallium.warppi.boot.StartupArguments;
|
||||||
import it.cavallium.warppi.util.EventSubmitter;
|
import it.cavallium.warppi.util.EventSubmitter;
|
||||||
|
|
||||||
|
@ -9,18 +7,9 @@ import it.cavallium.warppi.util.EventSubmitter;
|
||||||
* TODO: Move everything to Engine.Settings
|
* TODO: Move everything to Engine.Settings
|
||||||
*/
|
*/
|
||||||
public class StaticVars {
|
public class StaticVars {
|
||||||
public static final boolean zoomed = true;
|
public static final boolean zoomedFonts = true;
|
||||||
public static int outputLevel = 0;
|
public static int outputLevel = 0;
|
||||||
public static boolean debugWindow2x = false;
|
|
||||||
public static EventSubmitter<Float> windowZoom = new EventSubmitter<>(1F);
|
public static EventSubmitter<Float> windowZoom = new EventSubmitter<>(1F);
|
||||||
public static Function<Float, Float> windowZoomFunction = (val) -> {
|
|
||||||
if (StaticVars.debugWindow2x) {
|
|
||||||
return val + 1;
|
|
||||||
} else {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public static EventSubmitter<Float> windowZoom$ = StaticVars.windowZoom.map(StaticVars.windowZoomFunction);
|
|
||||||
public static StartupArguments startupArguments;
|
public static StartupArguments startupArguments;
|
||||||
|
|
||||||
private StaticVars() {
|
private StaticVars() {
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class WarpPI {
|
||||||
private void initializeEnvironment(final StartupArguments args) throws IOException {
|
private void initializeEnvironment(final StartupArguments args) throws IOException {
|
||||||
ClassUtils.classLoader = this.getClass();
|
ClassUtils.classLoader = this.getClass();
|
||||||
StaticVars.startupArguments = args;
|
StaticVars.startupArguments = args;
|
||||||
StaticVars.debugWindow2x = args.isZoomed();
|
StaticVars.windowZoom.submit(args.isZoomed() ? 2f : 1f);
|
||||||
if (args.isVerboseLoggingEnabled() || args.isDebugEnabled()) {
|
if (args.isVerboseLoggingEnabled() || args.isDebugEnabled()) {
|
||||||
StaticVars.outputLevel = ConsoleUtils.OUTPUTLEVEL_DEBUG_VERBOSE;
|
StaticVars.outputLevel = ConsoleUtils.OUTPUTLEVEL_DEBUG_VERBOSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class Boot {
|
||||||
case "-noraspi":
|
case "-noraspi":
|
||||||
args.setRaspberryModeAllowed(false);
|
args.setRaspberryModeAllowed(false);
|
||||||
break;
|
break;
|
||||||
case "nogui":
|
case "nogui":
|
||||||
args.setNoGUIEngineForced(true);
|
args.setNoGUIEngineForced(true);
|
||||||
break;
|
break;
|
||||||
case "ms-dos":
|
case "ms-dos":
|
||||||
|
|
|
@ -47,9 +47,9 @@ public abstract class Block implements TreeBlock, GraphicalElement {
|
||||||
*/
|
*/
|
||||||
public abstract void draw(DisplayOutputDevice ge, Renderer r, int x, int y, Caret caret);
|
public abstract void draw(DisplayOutputDevice ge, Renderer r, int x, int y, Caret caret);
|
||||||
|
|
||||||
public abstract boolean putBlock(Caret caret, Block newBlock);
|
public abstract boolean appendBlock(Caret caret, Block newBlock, boolean splitAdjacent);
|
||||||
|
|
||||||
public abstract boolean delBlock(Caret caret);
|
public abstract boolean deleteBlock(Caret caret);
|
||||||
|
|
||||||
public abstract BlockReference<?> getBlock(Caret caret);
|
public abstract BlockReference<?> getBlock(Caret caret);
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,12 @@ public class BlockChar extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package it.cavallium.warppi.gui.expression.blocks;
|
package it.cavallium.warppi.gui.expression.blocks;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import it.cavallium.warppi.WarpPI;
|
import it.cavallium.warppi.WarpPI;
|
||||||
import it.cavallium.warppi.device.display.DisplayOutputDevice;
|
import it.cavallium.warppi.device.display.DisplayOutputDevice;
|
||||||
import it.cavallium.warppi.gui.GraphicalElement;
|
import it.cavallium.warppi.gui.GraphicalElement;
|
||||||
|
@ -213,7 +211,7 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
|
||||||
caret.skip(1);
|
caret.skip(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
|
|
||||||
if (caret.getRemaining() == 0) {
|
if (caret.getRemaining() == 0) {
|
||||||
|
@ -225,7 +223,7 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
|
||||||
for (final Block b : content) {
|
for (final Block b : content) {
|
||||||
caret.skip(1);
|
caret.skip(1);
|
||||||
pos++;
|
pos++;
|
||||||
added = added | b.putBlock(caret, newBlock);
|
added = added | b.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (caret.getRemaining() == 0) {
|
if (caret.getRemaining() == 0) {
|
||||||
addBlock(pos, newBlock);
|
addBlock(pos, newBlock);
|
||||||
added = true;
|
added = true;
|
||||||
|
@ -238,7 +236,7 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -247,7 +245,7 @@ public class BlockContainer implements TreeContainer, GraphicalElement {
|
||||||
pos++;
|
pos++;
|
||||||
final int deltaCaret = caret.getRemaining();
|
final int deltaCaret = caret.getRemaining();
|
||||||
final int caretOldPos = caret.getPosition();
|
final int caretOldPos = caret.getPosition();
|
||||||
removed = removed | b.delBlock(caret);
|
removed = removed | b.deleteBlock(caret);
|
||||||
if (caret.getRemaining() == 0 || removed == false && deltaCaret >= 0 && caret.getRemaining() < 0) {
|
if (caret.getRemaining() == 0 || removed == false && deltaCaret >= 0 && caret.getRemaining() < 0) {
|
||||||
ObjectArrayList<Block> blocks = this.getBlockAt(pos - 1).get().getInnerBlocks();
|
ObjectArrayList<Block> blocks = this.getBlockAt(pos - 1).get().getInnerBlocks();
|
||||||
ObjectArrayList<BlockContainer> innerContainers = this.getBlockAt(pos - 1).get().getInnerContainers();
|
ObjectArrayList<BlockContainer> innerContainers = this.getBlockAt(pos - 1).get().getInnerContainers();
|
||||||
|
|
|
@ -9,7 +9,6 @@ import it.cavallium.warppi.math.MathContext;
|
||||||
import it.cavallium.warppi.math.parser.features.FeatureDivision;
|
import it.cavallium.warppi.math.parser.features.FeatureDivision;
|
||||||
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
import it.cavallium.warppi.math.parser.features.interfaces.Feature;
|
||||||
import it.cavallium.warppi.util.Error;
|
import it.cavallium.warppi.util.Error;
|
||||||
import it.unimi.dsi.fastutil.objects.AbstractObjectList;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
|
||||||
public class BlockDivision extends Block {
|
public class BlockDivision extends Block {
|
||||||
|
@ -48,10 +47,10 @@ public class BlockDivision extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerUp.putBlock(caret, newBlock);
|
added = added | containerUp.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
added = added | containerDown.putBlock(caret, newBlock);
|
added = added | containerDown.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -59,10 +58,10 @@ public class BlockDivision extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerUp.delBlock(caret);
|
removed = removed | containerUp.deleteBlock(caret);
|
||||||
removed = removed | containerDown.delBlock(caret);
|
removed = removed | containerDown.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,10 +80,10 @@ public class BlockLogarithm extends Block implements IParenthesis {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerBase.putBlock(caret, newBlock);
|
added = added | containerBase.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
added = added | containerNumber.putBlock(caret, newBlock);
|
added = added | containerNumber.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -91,10 +91,10 @@ public class BlockLogarithm extends Block implements IParenthesis {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerBase.delBlock(caret);
|
removed = removed | containerBase.deleteBlock(caret);
|
||||||
removed = removed | containerNumber.delBlock(caret);
|
removed = removed | containerNumber.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public abstract class BlockParenthesisAbstract extends Block implements IParenth
|
||||||
BlockContainer.getDefaultFont(small).use(ge);
|
BlockContainer.getDefaultFont(small).use(ge);
|
||||||
r.glColor(BlockContainer.getDefaultColor());
|
r.glColor(BlockContainer.getDefaultColor());
|
||||||
if (prefix != null) {
|
if (prefix != null) {
|
||||||
r.glDrawStringLeft(x + 1, y + line - chh / 2, prefix);
|
r.glDrawStringLeft(x + 1, y + line - chh / 2f, prefix);
|
||||||
}
|
}
|
||||||
r.glDrawCharLeft(x + prw, y, '╭');
|
r.glDrawCharLeft(x + prw, y, '╭');
|
||||||
r.glDrawCharLeft(x + prw, y + height - chh, '╰');
|
r.glDrawCharLeft(x + prw, y + height - chh, '╰');
|
||||||
|
@ -73,9 +73,9 @@ public abstract class BlockParenthesisAbstract extends Block implements IParenth
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerNumber.putBlock(caret, newBlock);
|
added = added | containerNumber.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -83,9 +83,9 @@ public abstract class BlockParenthesisAbstract extends Block implements IParenth
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerNumber.delBlock(caret);
|
removed = removed | containerNumber.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ public class BlockPower extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerExponent.putBlock(caret, newBlock);
|
added = added | containerExponent.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ public class BlockPower extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(Caret caret) {
|
public boolean deleteBlock(Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerExponent.delBlock(caret);
|
removed = removed | containerExponent.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ public class BlockPower2 extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerExponent.putBlock(caret, newBlock);
|
added = added | containerExponent.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,9 @@ public class BlockPower2 extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerExponent.delBlock(caret);
|
removed = removed | containerExponent.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,9 @@ public class BlockSquareRoot extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
added = added | containerNumber.putBlock(caret, newBlock);
|
added = added | containerNumber.appendBlock(caret, newBlock, splitAdjacent);
|
||||||
if (added) {
|
if (added) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ public class BlockSquareRoot extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
removed = removed | containerNumber.delBlock(caret);
|
removed = removed | containerNumber.deleteBlock(caret);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
recomputeDimensions();
|
recomputeDimensions();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ public class BlockUndefined extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package it.cavallium.warppi.gui.expression.blocks;
|
package it.cavallium.warppi.gui.expression.blocks;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import it.cavallium.warppi.WarpPI;
|
import it.cavallium.warppi.WarpPI;
|
||||||
import it.cavallium.warppi.device.display.DisplayOutputDevice;
|
import it.cavallium.warppi.device.display.DisplayOutputDevice;
|
||||||
import it.cavallium.warppi.event.KeyPressedEvent;
|
import it.cavallium.warppi.event.KeyPressedEvent;
|
||||||
|
@ -108,12 +106,12 @@ public class BlockVariable extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean putBlock(final Caret caret, final Block newBlock) {
|
public boolean appendBlock(final Caret caret, final Block newBlock, boolean splitAdjacent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delBlock(final Caret caret) {
|
public boolean deleteBlock(final Caret caret) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import it.cavallium.warppi.gui.expression.ExtraMenu;
|
||||||
import it.cavallium.warppi.gui.expression.InputContext;
|
import it.cavallium.warppi.gui.expression.InputContext;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.Block;
|
import it.cavallium.warppi.gui.expression.blocks.Block;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
|
import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
|
||||||
|
import it.cavallium.warppi.gui.expression.blocks.BlockDivision;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockReference;
|
import it.cavallium.warppi.gui.expression.blocks.BlockReference;
|
||||||
import it.cavallium.warppi.gui.expression.layouts.InputLayout;
|
import it.cavallium.warppi.gui.expression.layouts.InputLayout;
|
||||||
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
||||||
|
@ -76,7 +77,11 @@ public abstract class InputContainer implements GraphicalElement, InputLayout {
|
||||||
public void typeBlock(final Block b) {
|
public void typeBlock(final Block b) {
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
caret.resetRemaining();
|
caret.resetRemaining();
|
||||||
if (root.putBlock(caret, b)) {
|
|
||||||
|
// todo: allow blocks to dinamically choose insert mode
|
||||||
|
var splitAdjacent = b instanceof BlockDivision;
|
||||||
|
|
||||||
|
if (root.appendBlock(caret, b, splitAdjacent)) {
|
||||||
caret.setPosition(caret.getPosition() + b.getCaretDeltaPositionAfterCreation());
|
caret.setPosition(caret.getPosition() + b.getCaretDeltaPositionAfterCreation());
|
||||||
maxPosition = root.computeCaretMaxBound();
|
maxPosition = root.computeCaretMaxBound();
|
||||||
root.recomputeDimensions();
|
root.recomputeDimensions();
|
||||||
|
@ -93,7 +98,7 @@ public abstract class InputContainer implements GraphicalElement, InputLayout {
|
||||||
|
|
||||||
public void del() {
|
public void del() {
|
||||||
caret.resetRemaining();
|
caret.resetRemaining();
|
||||||
if (root.delBlock(caret)) {
|
if (root.deleteBlock(caret)) {
|
||||||
root.recomputeDimensions();
|
root.recomputeDimensions();
|
||||||
}
|
}
|
||||||
if (caret.getPosition() > 0) {
|
if (caret.getPosition() > 0) {
|
||||||
|
|
|
@ -3,20 +3,7 @@ package it.cavallium.warppi.gui.expression.containers;
|
||||||
import it.cavallium.warppi.gui.expression.Caret;
|
import it.cavallium.warppi.gui.expression.Caret;
|
||||||
import it.cavallium.warppi.gui.expression.CaretState;
|
import it.cavallium.warppi.gui.expression.CaretState;
|
||||||
import it.cavallium.warppi.gui.expression.InputContext;
|
import it.cavallium.warppi.gui.expression.InputContext;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.Block;
|
import it.cavallium.warppi.gui.expression.blocks.*;
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockChar;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockContainer;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockDivision;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockLogarithm;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockNumericChar;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockParenthesis;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockPower;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockPower2;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockReference;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockSine;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockSquareRoot;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.BlockVariable;
|
|
||||||
import it.cavallium.warppi.gui.expression.blocks.IParenthesis;
|
|
||||||
import it.cavallium.warppi.math.MathematicalSymbols;
|
import it.cavallium.warppi.math.MathematicalSymbols;
|
||||||
|
|
||||||
public class NormalInputContainer extends InputContainer {
|
public class NormalInputContainer extends InputContainer {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class LoadingScreen extends Screen {
|
||||||
@Override
|
@Override
|
||||||
public void initialized() throws InterruptedException {
|
public void initialized() throws InterruptedException {
|
||||||
float lastZoomValue = StaticVars.windowZoom.getLastValue();
|
float lastZoomValue = StaticVars.windowZoom.getLastValue();
|
||||||
previousZoomValue = StaticVars.windowZoomFunction.apply(lastZoomValue);
|
previousZoomValue = lastZoomValue;
|
||||||
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getHUD().hide();
|
WarpPI.INSTANCE.getHardwareDevice().getDisplayManager().getHUD().hide();
|
||||||
if (lastZoomValue != 1.0f) {
|
if (lastZoomValue != 1.0f) {
|
||||||
StaticVars.windowZoom.submit(1f);
|
StaticVars.windowZoom.submit(1f);
|
||||||
|
|
|
@ -395,7 +395,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final BinaryFont getFont(final boolean small) {
|
public static final BinaryFont getFont(final boolean small) {
|
||||||
return Utils.getFont(small, StaticVars.zoomed);
|
return Utils.getFont(small, StaticVars.zoomedFonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final BinaryFont getFont(final boolean small, final boolean zoomed) {
|
public static final BinaryFont getFont(final boolean small, final boolean zoomed) {
|
||||||
|
@ -417,7 +417,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int getFontHeight(final boolean small) {
|
public static final int getFontHeight(final boolean small) {
|
||||||
return Utils.getFontHeight(small, StaticVars.zoomed);
|
return Utils.getFontHeight(small, StaticVars.zoomedFonts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int getFontHeight(final boolean small, final boolean zoomed) {
|
public static final int getFontHeight(final boolean small, final boolean zoomed) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class SwingWindow extends JFrame {
|
||||||
// Transparent 16 x 16 pixel cursor image.
|
// Transparent 16 x 16 pixel cursor image.
|
||||||
final BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
final BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
mult = StaticVars.windowZoomFunction.apply(StaticVars.windowZoom.getLastValue()).intValue();
|
mult = StaticVars.windowZoom.getLastValue().intValue();
|
||||||
|
|
||||||
if (!WarpPI.getPlatform().getSettings().isDebugEnabled()) {
|
if (!WarpPI.getPlatform().getSettings().isDebugEnabled()) {
|
||||||
// Create a new blank cursor.
|
// Create a new blank cursor.
|
||||||
|
@ -150,7 +150,7 @@ public class SwingWindow extends JFrame {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
StaticVars.windowZoom$.subscribe((newZoomValue) -> {
|
StaticVars.windowZoom.subscribe((newZoomValue) -> {
|
||||||
mult = (int) newZoomValue.floatValue();
|
mult = (int) newZoomValue.floatValue();
|
||||||
onResize.submit(new Integer[]{getWWidth(), getWHeight()});
|
onResize.submit(new Integer[]{getWWidth(), getWHeight()});
|
||||||
WarpPI.getPlatform().getConsoleUtils().out().println(3, "Engine", "CPU", "Zoom changed");
|
WarpPI.getPlatform().getConsoleUtils().out().println(3, "Engine", "CPU", "Zoom changed");
|
||||||
|
@ -159,7 +159,7 @@ public class SwingWindow extends JFrame {
|
||||||
|
|
||||||
private void setupButtonsPanel() throws IOException, URISyntaxException {
|
private void setupButtonsPanel() throws IOException, URISyntaxException {
|
||||||
BTN_SIZE = 32;
|
BTN_SIZE = 32;
|
||||||
if (StaticVars.debugWindow2x)
|
if (StaticVars.startupArguments.isZoomed())
|
||||||
BTN_SIZE *= 2;
|
BTN_SIZE *= 2;
|
||||||
|
|
||||||
buttons = new SwingAdvancedButton[8][8];
|
buttons = new SwingAdvancedButton[8][8];
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
|
|
||||||
package it.cavallium.warppi.gui.graphicengine.impl.jogl;
|
package it.cavallium.warppi.gui.graphicengine.impl.jogl;
|
||||||
|
|
||||||
|
import com.jogamp.nativewindow.AbstractGraphicsDevice;
|
||||||
|
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
|
||||||
|
import com.jogamp.newt.Display;
|
||||||
|
import com.jogamp.newt.Screen;
|
||||||
import com.jogamp.newt.event.KeyEvent;
|
import com.jogamp.newt.event.KeyEvent;
|
||||||
import com.jogamp.newt.event.KeyListener;
|
import com.jogamp.newt.event.KeyListener;
|
||||||
import com.jogamp.newt.event.WindowEvent;
|
import com.jogamp.newt.event.WindowEvent;
|
||||||
|
@ -51,6 +55,11 @@ import it.cavallium.warppi.device.input.Keyboard;
|
||||||
import it.cavallium.warppi.StaticVars;
|
import it.cavallium.warppi.StaticVars;
|
||||||
import it.cavallium.warppi.event.Key;
|
import it.cavallium.warppi.event.Key;
|
||||||
import it.cavallium.warppi.util.EventSubmitter;
|
import it.cavallium.warppi.util.EventSubmitter;
|
||||||
|
import jogamp.newt.driver.bcm.vc.iv.DisplayDriver;
|
||||||
|
import jogamp.newt.driver.bcm.vc.iv.ScreenDriver;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -63,7 +72,7 @@ class NEWTWindow implements GLEventListener {
|
||||||
private final JOGLEngine engine;
|
private final JOGLEngine engine;
|
||||||
private final JOGLRenderer renderer;
|
private final JOGLRenderer renderer;
|
||||||
public GLWindow window;
|
public GLWindow window;
|
||||||
public volatile float windowZoom = 1;
|
public volatile float windowZoom = 1f;
|
||||||
public int[] realWindowSize;
|
public int[] realWindowSize;
|
||||||
public Runnable onInitialized;
|
public Runnable onInitialized;
|
||||||
public volatile boolean refreshViewport;
|
public volatile boolean refreshViewport;
|
||||||
|
@ -79,7 +88,7 @@ class NEWTWindow implements GLEventListener {
|
||||||
engine.size[0] = engine.getSize()[0];
|
engine.size[0] = engine.getSize()[0];
|
||||||
engine.size[1] = engine.getSize()[1];
|
engine.size[1] = engine.getSize()[1];
|
||||||
realWindowSize = new int[] { engine.getSize()[0], engine.getSize()[1] };
|
realWindowSize = new int[] { engine.getSize()[0], engine.getSize()[1] };
|
||||||
windowZoom = StaticVars.windowZoomFunction.apply(StaticVars.windowZoom.getLastValue());
|
windowZoom = StaticVars.windowZoom.getLastValue();
|
||||||
onRealResize = EventSubmitter.create(new Integer[] { (int) (engine.getSize()[0] * windowZoom), (int) (engine.getSize()[1] * windowZoom) });
|
onRealResize = EventSubmitter.create(new Integer[] { (int) (engine.getSize()[0] * windowZoom), (int) (engine.getSize()[1] * windowZoom) });
|
||||||
|
|
||||||
onRealResize.subscribe((realSize) -> {
|
onRealResize.subscribe((realSize) -> {
|
||||||
|
@ -90,7 +99,7 @@ class NEWTWindow implements GLEventListener {
|
||||||
onResizeEvent.submit(new Integer[] { engine.size[0], engine.size[1] });
|
onResizeEvent.submit(new Integer[] { engine.size[0], engine.size[1] });
|
||||||
refreshViewport = true;
|
refreshViewport = true;
|
||||||
});
|
});
|
||||||
StaticVars.windowZoom$.subscribe(onZoom::submit);
|
StaticVars.windowZoom.subscribe(onZoom::submit);
|
||||||
onZoom.subscribe((z) -> {
|
onZoom.subscribe((z) -> {
|
||||||
if (windowZoom != 0) {
|
if (windowZoom != 0) {
|
||||||
windowZoom = z;
|
windowZoom = z;
|
||||||
|
@ -105,7 +114,12 @@ class NEWTWindow implements GLEventListener {
|
||||||
|
|
||||||
public void create() {
|
public void create() {
|
||||||
System.out.println("Loading OpenGL...");
|
System.out.println("Loading OpenGL...");
|
||||||
System.out.println(GLProfile.glAvailabilityToString());
|
GLProfile.initSingleton();
|
||||||
|
try {
|
||||||
|
System.out.println(GLProfile.glAvailabilityToString());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.out.println("OpenGL Capabilities are not available. " + ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
if (!GLProfile.isAvailable(GLProfile.GL2ES1)) {
|
if (!GLProfile.isAvailable(GLProfile.GL2ES1)) {
|
||||||
System.err.println("Le OpenGL non sono presenti su questo computer!");
|
System.err.println("Le OpenGL non sono presenti su questo computer!");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user