Skip to content

Commit 1bc4747

Browse files
committed
Add arrow labels to Emg Joystick Input dropdowns
1 parent 676cdcb commit 1bc4747

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

OpenBCI_GUI/W_EMGJoystick.pde

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class W_EMGJoystick extends Widget {
6666
private TextBox yPositiveInputDropdownLabel;
6767
private TextBox yNegativeInputDropdownLabel;
6868

69+
private PImage xNegativeInputLabelImage = loadImage("LEFT_100x100.png");
70+
private PImage xPositiveInputLabelImage = loadImage("RIGHT_100x100.png");
71+
private PImage yPositiveInputLabelImage = loadImage("UP_100x100.png");
72+
private PImage yNegativeInputLabelImage = loadImage("DOWN_100x100.png");
73+
6974
W_EMGJoystick(PApplet _parent){
7075
super(_parent); //calls the parent CONSTRUCTOR method of Widget (DON'T REMOVE)
7176

@@ -109,8 +114,6 @@ class W_EMGJoystick extends Widget {
109114
drawEmgVisualization(emgJoystickInputs[1].getIndex(), rightPolarX, rightPolarY);
110115
drawEmgVisualization(emgJoystickInputs[2].getIndex(), topPolarX, topPolarY);
111116
drawEmgVisualization(emgJoystickInputs[3].getIndex(), bottomPolarX, bottomPolarY);
112-
113-
//drawChannelLabels();
114117

115118
drawInputDropdownLabels();
116119

@@ -407,10 +410,11 @@ class W_EMGJoystick extends Widget {
407410
}
408411

409412
private void updateInputDropdownPositions(){
413+
final int Y_AXIS_ARROW_LABEL_WIDTH = DROPDOWN_HEIGHT + DROPDOWN_SPACER;
410414
xNegativeInputDropdown.setPosition((int) (x + navH + DROPDOWN_LABEL_WIDTH), (int) (y + navH + 1));
411415
xPositiveInputDropdown.setPosition((int) (x + navH + DROPDOWN_LABEL_WIDTH), (int) (y + navH + DROPDOWN_SPACER + DROPDOWN_HEIGHT));
412-
yPositiveInputDropdown.setPosition((int) (x + w - navH - DROPDOWN_WIDTH), (int) (y + navH + 1));
413-
yNegativeInputDropdown.setPosition((int) (x + w - navH - DROPDOWN_WIDTH), (int) (y + navH + DROPDOWN_SPACER + DROPDOWN_HEIGHT));
416+
yPositiveInputDropdown.setPosition((int) (x + w - navH - DROPDOWN_WIDTH - Y_AXIS_ARROW_LABEL_WIDTH), (int) (y + navH + 1));
417+
yNegativeInputDropdown.setPosition((int) (x + w - navH - DROPDOWN_WIDTH - Y_AXIS_ARROW_LABEL_WIDTH), (int) (y + navH + DROPDOWN_SPACER + DROPDOWN_HEIGHT));
414418
xNegativeInputDropdownLabel.setPosition((int) xNegativeInputDropdown.getPosition()[0] - DROPDOWN_LABEL_WIDTH, (int) xNegativeInputDropdown.getPosition()[1]);
415419
xPositiveInputDropdownLabel.setPosition((int) xPositiveInputDropdown.getPosition()[0] - DROPDOWN_LABEL_WIDTH, (int) xPositiveInputDropdown.getPosition()[1]);
416420
yPositiveInputDropdownLabel.setPosition((int) yPositiveInputDropdown.getPosition()[0] - DROPDOWN_LABEL_WIDTH, (int) yPositiveInputDropdown.getPosition()[1]);
@@ -422,6 +426,13 @@ class W_EMGJoystick extends Widget {
422426
xPositiveInputDropdownLabel.draw();
423427
yPositiveInputDropdownLabel.draw();
424428
yNegativeInputDropdownLabel.draw();
429+
430+
pushStyle();
431+
final int X_OFFSET = DROPDOWN_WIDTH + DROPDOWN_SPACER;
432+
image(xNegativeInputLabelImage, xNegativeInputDropdown.getPosition()[0] + X_OFFSET, xNegativeInputDropdown.getPosition()[1] + 2, DROPDOWN_HEIGHT, DROPDOWN_HEIGHT);
433+
image(xPositiveInputLabelImage, xPositiveInputDropdown.getPosition()[0] + X_OFFSET, xPositiveInputDropdown.getPosition()[1] + 2, DROPDOWN_HEIGHT, DROPDOWN_HEIGHT);
434+
image(yPositiveInputLabelImage, yPositiveInputDropdown.getPosition()[0] + X_OFFSET, yPositiveInputDropdown.getPosition()[1] + 2, DROPDOWN_HEIGHT, DROPDOWN_HEIGHT);
435+
image(yNegativeInputLabelImage, yNegativeInputDropdown.getPosition()[0] + X_OFFSET, yNegativeInputDropdown.getPosition()[1] + 2, DROPDOWN_HEIGHT, DROPDOWN_HEIGHT);
425436
}
426437

427438
public void updateJoystickInput(int inputNumber, Integer value) {

OpenBCI_GUI/data/DOWN_100x100.png

920 Bytes
Loading

OpenBCI_GUI/data/LEFT_100x100.png

876 Bytes
Loading

OpenBCI_GUI/data/RIGHT_100x100.png

846 Bytes
Loading

OpenBCI_GUI/data/UP_100x100.png

935 Bytes
Loading

0 commit comments

Comments
 (0)