This commit is contained in:
Andrea Cavalli 2018-05-06 16:37:25 +02:00
parent 3358028a71
commit 47fe4f5647
10 changed files with 20 additions and 3 deletions

View File

@ -107,6 +107,7 @@ public class Utils {
.replace(""+MathematicalSymbols.ARC_TANGENT, "atan")
.replace(""+MathematicalSymbols.UNDEFINED, "undefined")
.replace(""+MathematicalSymbols.PI, "PI")
.replace(""+MathematicalSymbols.EULER_NUMBER, "EULER_NUMBER")
.replace(""+MathematicalSymbols.X, "X")
.replace(""+MathematicalSymbols.Y, "Y")
;

View File

@ -8,5 +8,5 @@ public enum Key {
PLUS, MINUS, PLUS_MINUS, MULTIPLY, DIVIDE, EQUAL, DELETE, RESET, LEFT, RIGHT,
UP, DOWN, OK, debug1, debug2, debug3, debug4, debug5, SQRT, ROOT, POWER_OF_2,
POWER_OF_x, SINE, COSINE, TANGENT, ARCSINE, ARCCOSINE, ARCTANGENT, PI, SETTINGS,
F1, F2, F3, F4, BACK, ZOOM_MODE, LOGARITHM
F1, F2, F3, F4, BACK, ZOOM_MODE, LOGARITHM, EULER_NUMBER
}

View File

@ -170,6 +170,15 @@ public class Keyboard {
Keyboard.keyPressed(Key.NONE);
}
break;
case KeyEvent.VK_E:
if (Keyboard.shift) {
Keyboard.keyPressed(Key.NONE);
} else if (Keyboard.alpha) {
Keyboard.keyPressed(Key.NONE);
} else {
Keyboard.keyPressed(Key.EULER_NUMBER);
}
break;
case KeyEvent.VK_Y:
if (Keyboard.alpha) {
Keyboard.keyPressed(Key.LETTER_Y);

View File

@ -13,6 +13,7 @@ public class InputContext {
public InputContext() {
this.variableTypes = new HashMap<>();
this.variableTypes.put(MathematicalSymbols.PI, V_TYPE.CONSTANT);
this.variableTypes.put(MathematicalSymbols.EULER_NUMBER, V_TYPE.CONSTANT);
}
public InputContext(HashMap<Character, V_TYPE> variableTypes) {

View File

@ -76,6 +76,8 @@ public class NormalInputContainer extends InputContainer {
return new BlockLogarithm();
case MathematicalSymbols.PI:
return new BlockVariable(inputContext, c, true);
case MathematicalSymbols.EULER_NUMBER:
return new BlockVariable(inputContext, c, true);
default:
for (char v : MathematicalSymbols.variables) {
if (c == v) {

View File

@ -110,7 +110,7 @@ public class CPUFont implements BinaryFont {
minBound = file[0x9] << 24 | file[0xA] << 16 | file[0xB] << 8 | file[0xC];
maxBound = file[0xE] << 24 | file[0xF] << 16 | file[0x10] << 8 | file[0x11];
if (maxBound <= minBound) {
maxBound = 9900; //TODO remove it: temp fix
maxBound = 66000; //TODO remove it: temp fix
}
rawchars = new boolean[maxBound - minBound][];
int index = 0x12;

View File

@ -337,6 +337,9 @@ public class MathInputScreen extends Screen {
case PI:
typeChar(MathematicalSymbols.PI);
return true;
case EULER_NUMBER:
typeChar(MathematicalSymbols.EULER_NUMBER);
return true;
case LETTER_X:
typeChar(MathematicalSymbols.variables[23]);
return true;

View File

@ -28,6 +28,7 @@ public class MathematicalSymbols {
public static final char LOGARITHM = 'Ⓙ';
public static final char UNDEFINED = '∅';
public static final char PI = 'π';
public static final char EULER_NUMBER = '';
public static final char X = 'ⓧ';
public static final char Y = 'Ⓨ';
@ -52,7 +53,7 @@ public class MathematicalSymbols {
public static final char[] parentheses = new char[] { PARENTHESIS_OPEN, PARENTHESIS_CLOSE };
public static final char[] variables = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', X, Y, 'Z', PI, UNDEFINED };
public static final char[] variables = new char[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', X, Y, 'Z', PI, EULER_NUMBER, UNDEFINED };
public static final char[] genericSyntax = new char[] { SYSTEM, EQUATION };

Binary file not shown.

Binary file not shown.