mirror of
https://github.com/opus-tango/B12NumbersV3.git
synced 2026-03-20 03:55:20 +00:00
0.2.1.1 - Finished Clock
This commit is contained in:
@@ -145,7 +145,7 @@ class B12Int implements Number {
|
|||||||
PVector getPos(){ return pos; }
|
PVector getPos(){ return pos; }
|
||||||
B12Float toFloat(){return new B12Float(float(value)); }
|
B12Float toFloat(){return new B12Float(float(value)); }
|
||||||
B12Digit[] getDigits(){
|
B12Digit[] getDigits(){
|
||||||
loadArray(); //<>//
|
loadArray();
|
||||||
B12Digit[] out = digits;
|
B12Digit[] out = digits;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void setup(){
|
|||||||
ex = new B12Expression();
|
ex = new B12Expression();
|
||||||
|
|
||||||
//ca = new ClockApp(mh, time).setPos(-43,0);
|
//ca = new ClockApp(mh, time).setPos(-43,0);
|
||||||
clock = new Clock(mh, time);
|
clock = new Clock(mh, time);//.setPos(40,20);
|
||||||
calc = new Calculator(mh, ex);
|
calc = new Calculator(mh, ex);
|
||||||
|
|
||||||
mode = new Button(mh).setPos(new PVector(-20,-100), new PVector(40,20)).setRadius(2).setColor(#8B687F).autoHighlight().setText("Mode").setFunction(new MethodRelay(this, "changeMode"));
|
mode = new Button(mh).setPos(new PVector(-20,-100), new PVector(40,20)).setRadius(2).setColor(#8B687F).autoHighlight().setText("Mode").setFunction(new MethodRelay(this, "changeMode"));
|
||||||
@@ -51,6 +51,7 @@ void draw(){
|
|||||||
//mode.display();
|
//mode.display();
|
||||||
|
|
||||||
clock.display();
|
clock.display();
|
||||||
|
//point(-15,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +87,10 @@ void reset(){
|
|||||||
calc.ex.clear();
|
calc.ex.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test(){
|
||||||
|
background(255,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
void crossMark(){
|
void crossMark(){
|
||||||
line(offset.x,0,offset.x,height);
|
line(offset.x,0,offset.x,height);
|
||||||
line(0,offset.y,width,offset.y);
|
line(0,offset.y,width,offset.y);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Clock{
|
|||||||
|
|
||||||
void initialize(){
|
void initialize(){
|
||||||
buttons = new Button[0];
|
buttons = new Button[0];
|
||||||
td.setPos(pos.x,pos.y);
|
td.setPos(pos.x + 13*4 + 2,pos.y-2);
|
||||||
// Create numpad buttons
|
// Create numpad buttons
|
||||||
for(int i = 0; i < 12; i++){
|
for(int i = 0; i < 12; i++){
|
||||||
/* Button position must contain it's absolute position relative to sketch 0,0 for mouseOver to work.
|
/* Button position must contain it's absolute position relative to sketch 0,0 for mouseOver to work.
|
||||||
@@ -33,30 +33,44 @@ class Clock{
|
|||||||
absolute position of the button */
|
absolute position of the button */
|
||||||
// x = pos.x + (width + gap) * (i%cols)
|
// x = pos.x + (width + gap) * (i%cols)
|
||||||
// y = pos.y + (height + gap) * b2rows - (height + gap) * row
|
// y = pos.y + (height + gap) * b2rows - (height + gap) * row
|
||||||
PVector bPos = new PVector(pos.x + 22 * int(i%4),pos.y + 22 * 2 - 22 * floor(i/4));
|
PVector bPos = new PVector(pos.x + 22 * int(i%4) - 43,pos.y + 22 * 2 - 22 * floor(i/4) + 2);
|
||||||
buttons = (Button[])append(buttons, new B12Button(mh ,new B12Digit(i)).setPos(bPos).setDim(new PVector(20,20)).setFunction(new MethodRelay(this, "addChar", B12Digit.class)).setColor(220,150));
|
buttons = (Button[])append(buttons, new B12Button(mh ,new B12Digit(i)).setPos(bPos).setDim(new PVector(20,20)).setFunction(new MethodRelay(this, "addChar", B12Digit.class)).setColor(220,150));
|
||||||
}
|
}
|
||||||
// Create other buttons
|
// Create other buttons
|
||||||
buttons = (Button[])append(buttons, new Button(mh).setText("Set").setPos(new PVector(pos.x,pos.y + 22*3)).setDim(new PVector(42,20)).setFunction(new MethodRelay(this, "lockTime")).setColor(220,150));
|
buttons = (Button[])append(buttons, new Button(mh).setText("Set").setPos(new PVector(pos.x - 43,pos.y + 22*3 + 2)).setDim(new PVector(27,20)).setFunction(new MethodRelay(this, "lockTime")).setColor(220,150));
|
||||||
buttons = (Button[])append(buttons, new Button(mh).setText("Clear").setPos(new PVector(pos.x + 22*2,pos.y + 22*3)).setDim(new PVector(42,20)).setFunction(new MethodRelay(this, "clearTime")).setColor(220,150));
|
buttons = (Button[])append(buttons, new Button(mh).setText("Clear").setPos(new PVector(pos.x + 29 - 43,pos.y + 22*3 + 2)).setDim(new PVector(28,20)).setFunction(new MethodRelay(this, "clearTime")).setColor(220,150));
|
||||||
|
buttons = (Button[])append(buttons, new Button(mh).setText("Cancel").setPos(new PVector(pos.x + 59 - 43,pos.y + 22*3 + 2)).setDim(new PVector(27,20)).setFunction(new MethodRelay(this, "cancelSetTime")).setColor(220,150));
|
||||||
|
|
||||||
setTimeButton = new Button(mh).setText("Set Time").setPos(new PVector(pos.x+21,pos.y)).setDim(new PVector(42,13)).setFunction(new MethodRelay(this, "triggerSetTime")).setColor(220,150);
|
setTimeButton = new Button(mh).setText("Set Time").setPos(new PVector(pos.x-21,pos.y + 2)).setDim(new PVector(42,13)).setFunction(new MethodRelay(this, "triggerSetTime")).setColor(220,150);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void addChar(B12Digit digit){
|
void addChar(B12Digit digit){
|
||||||
switch(cursorPos){
|
switch(cursorPos){
|
||||||
|
case 0:
|
||||||
|
td.setTime(new Time48().setHour(digit.getValue() * 12)); cursorPos += 1; break;
|
||||||
|
case 1:
|
||||||
|
td.setTime(new Time48(td.getTime().tsec()).setHour(digit.getValue() + td.getTime().hours())); cursorPos += 2; break;
|
||||||
|
case 3:
|
||||||
|
td.setTime(new Time48(td.getTime().tsec()).setMin(digit.getValue() * 12)); cursorPos += 1; break;
|
||||||
|
case 4:
|
||||||
|
td.setTime(new Time48(td.getTime().tsec()).setMin(digit.getValue() + td.getTime().mins())); cursorPos += 2; break;
|
||||||
|
case 6:
|
||||||
|
td.setTime(new Time48(td.getTime().tsec()).setSec(digit.getValue() * 12)); cursorPos += 1; break;
|
||||||
|
case 7:
|
||||||
|
td.setTime(new Time48(td.getTime().tsec() + digit.getValue())); cursorPos += 1; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cursorPos
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void clearTime(){
|
void clearTime(){
|
||||||
td.setTime(new Time48(0));
|
td.setTime(new Time48(0));
|
||||||
|
cursorPos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lockTime(){
|
void lockTime(){
|
||||||
time.setTime(td.getTime());
|
time.setTime(td.getTime());
|
||||||
td.setTime(time);
|
td.setTime(time);
|
||||||
|
cursorPos = 0;
|
||||||
setTime = false;
|
setTime = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,11 +79,19 @@ class Clock{
|
|||||||
setTime = true;
|
setTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cancelSetTime(){
|
||||||
|
td.setTime(time); //<>//
|
||||||
|
cursorPos = 0;
|
||||||
|
setTime = false;
|
||||||
|
}
|
||||||
|
|
||||||
void display(){
|
void display(){
|
||||||
if(setTime){
|
if(setTime){
|
||||||
for(int i = 0; i < buttons.length; i++){
|
for(int i = 0; i < buttons.length; i++){
|
||||||
buttons[i].display();
|
buttons[i].display();
|
||||||
}
|
}
|
||||||
|
stroke(0);
|
||||||
|
if(cursorPos < 8)line(pos.x - 13 * (4-cursorPos) + 2, pos.y, pos.x - 13 * (4-cursorPos) + 10, pos.y);
|
||||||
}else{
|
}else{
|
||||||
setTimeButton.display();
|
setTimeButton.display();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,9 @@ class TimeDisplay {
|
|||||||
digits = (B12Digit[])append(digits,new B12Digit(':'));
|
digits = (B12Digit[])append(digits,new B12Digit(':'));
|
||||||
digits = (B12Digit[])concat(digits,hours.getDigits());
|
digits = (B12Digit[])concat(digits,hours.getDigits());
|
||||||
|
|
||||||
|
// Position
|
||||||
for(int i = 0; i < digits.length; i++){
|
for(int i = 0; i < digits.length; i++){
|
||||||
digits[i].setPos(i*-13 + pos.x,pos.y).display();
|
digits[i].setPos(i*-13 + pos.x - 13,pos.y).display();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
Beta version of a clock in base 12.
|
Beta version of a clock in base 12.
|
||||||
by Nayan Sawyer
|
by Nayan Sawyer
|
||||||
started Mar 2022
|
started Mar 2022
|
||||||
version 0.2.1.0 May 18 2022
|
version 0.2.1.1 May 18 2022
|
||||||
|
|
||||||
Characters are a variation of Kaktovik Inupiaq numerals
|
Characters are a variation of Kaktovik Inupiaq numerals
|
||||||
reversed and in base 12 instead of 20. I take no credit
|
reversed and in base 12 instead of 20. I take no credit
|
||||||
@@ -11,12 +11,16 @@
|
|||||||
Includes method relay code by Quark - see https://forum.processing.org/two/discussion/13093/how-to-call-function-by-string-content.html
|
Includes method relay code by Quark - see https://forum.processing.org/two/discussion/13093/how-to-call-function-by-string-content.html
|
||||||
for more details.
|
for more details.
|
||||||
|
|
||||||
// TODO switch B12Int from ArrayList to Array
|
// DONE get clock input to work properly
|
||||||
// DONE add actual math evaluation to B12Expression // Once thiss is done we hit version 0.2.0.0 //
|
// TODO finish clock applications
|
||||||
|
// DONE switch B12Int from ArrayList to Array
|
||||||
// TODO add throwing exceptions to all contructors
|
// TODO add throwing exceptions to all contructors
|
||||||
// MAYBE start clock widget structure
|
// MAYBE start clock widget structure
|
||||||
// MAYBE add additional operations like power, log, and trig functions
|
// MAYBE add additional operations like power, log, and trig functions
|
||||||
|
|
||||||
|
changelog 0.2.1.1
|
||||||
|
- Finished clock implementation
|
||||||
|
|
||||||
changelog 0.2.1.0
|
changelog 0.2.1.0
|
||||||
- Changes to the base code and the beginning of the clock
|
- Changes to the base code and the beginning of the clock
|
||||||
applications. File condensing (will be reversed)
|
applications. File condensing (will be reversed)
|
||||||
|
|||||||
Reference in New Issue
Block a user