Skip to content

Commit

Permalink
CATROID-1312 Added "stage width" and "stage height" reporter constants
Browse files Browse the repository at this point in the history
  • Loading branch information
JayTropper committed Dec 6, 2022
1 parent 909e73a commit 7126b1e
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 2 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,8 @@ class FormulaEditorSensorListTest(
"", str(R.string.formula_editor_device_sensors)
),
listOf(str(R.string.formula_editor_function_touched), "", ""),
listOf(str(R.string.formula_editor_sensor_stage_width), "", ""),
listOf(str(R.string.formula_editor_sensor_stage_height), "", ""),
listOf(
str(R.string.formula_editor_sensor_color_at_x_y),
str(R.string.formula_editor_sensor_color_at_x_y_parameter), ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ public List<InternToken> createInternTokenListByResourceId(int resource, String
return buildDoubleParameterFunction(Functions.COLOR_TOUCHES_COLOR, STRING, "#ff0000", STRING, "#ff0000");
case R.string.formula_editor_listening_language_sensor:
return buildSensor(Sensors.SPEECH_RECOGNITION_LANGUAGE);
case R.string.formula_editor_sensor_stage_width:
return buildSensor(Sensors.STAGE_WIDTH);
case R.string.formula_editor_sensor_stage_height:
return buildSensor(Sensors.STAGE_HEIGHT);

case R.string.formula_editor_function_get_id_of_detected_object:
return buildSingleParameterFunction(Functions.ID_OF_DETECTED_OBJECT, NUMBER, "1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ public class InternToExternGenerator {
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.NFC_TAG_ID.name(), R.string.formula_editor_nfc_tag_id);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.NFC_TAG_MESSAGE.name(), R.string.formula_editor_nfc_tag_message);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.LOUDNESS.name(), R.string.formula_editor_sensor_loudness);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.STAGE_WIDTH.name(),
R.string.formula_editor_sensor_stage_width);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.STAGE_HEIGHT.name(),
R.string.formula_editor_sensor_stage_height);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.TIMER.name(), R.string.formula_editor_sensor_timer);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.DATE_YEAR.name(), R.string.formula_editor_sensor_date_year);
INTERN_EXTERN_LANGUAGE_CONVERTER_MAP.put(Sensors.DATE_MONTH.name(), R.string.formula_editor_sensor_date_month);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ public static Object getSensorValue(Sensors sensor) {
return listeningLanguageSensor;
case USER_LANGUAGE:
return userLocaleTag;
case STAGE_WIDTH:
return (double) ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenWidth;
case STAGE_HEIGHT:
return (double) ProjectManager.getInstance().getCurrentProject().getXmlHeader().virtualScreenHeight;
default:
return instance.sensorValueMap.containsKey(sensor) ? instance.sensorValueMap.get(sensor) : 0.0d;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ DRONE_RECORDING, DRONE_NUM_FRAMES, COLLIDES_WITH_EDGE(true), COLLIDES_WITH_FINGE
NFC_TAG_ID(true), NFC_TAG_MESSAGE(true), GAMEPAD_A_PRESSED, GAMEPAD_B_PRESSED, GAMEPAD_UP_PRESSED,
GAMEPAD_DOWN_PRESSED, GAMEPAD_LEFT_PRESSED, GAMEPAD_RIGHT_PRESSED, TEXT_FROM_CAMERA,
TEXT_BLOCKS_NUMBER, TEXT_BLOCK_X, TEXT_BLOCK_Y,
TEXT_BLOCK_SIZE, TEXT_BLOCK_FROM_CAMERA, TEXT_BLOCK_LANGUAGE_FROM_CAMERA, SPEECH_RECOGNITION_LANGUAGE;
TEXT_BLOCK_SIZE, TEXT_BLOCK_FROM_CAMERA, TEXT_BLOCK_LANGUAGE_FROM_CAMERA,
SPEECH_RECOGNITION_LANGUAGE, STAGE_WIDTH, STAGE_HEIGHT;

public final boolean isObjectSensor;
public static final String TAG = Sensors.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ public class CategoryListFragment extends Fragment implements CategoryListRVAdap
R.string.formula_editor_logic_leserequal, R.string.formula_editor_logic_greaterthan,
R.string.formula_editor_logic_greaterequal);
private static final List<Integer> SENSORS_DEFAULT = asList(R.string.formula_editor_sensor_loudness,
R.string.formula_editor_function_touched);
R.string.formula_editor_function_touched, R.string.formula_editor_sensor_stage_width,
R.string.formula_editor_sensor_stage_height);
private static final List<Integer> OBJECT_COLOR_COLLISION =
asList(R.string.formula_editor_function_collides_with_color, R.string.formula_editor_function_color_touches_color);
private static final List<Integer> OBJECT_COLOR_PARAMS =
Expand Down
2 changes: 2 additions & 0 deletions catroid/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,8 @@ needs read and write access to it. You can always change permissions through you
<string name="formula_editor_sensor_gamepad_down_pressed">gamepad down pressed</string>
<string name="formula_editor_sensor_gamepad_left_pressed">gamepad left pressed</string>
<string name="formula_editor_sensor_gamepad_right_pressed">gamepad right pressed</string>
<string name="formula_editor_sensor_stage_width">stage width</string>
<string name="formula_editor_sensor_stage_height">stage height</string>
<string name="formula_editor_phiro_sensor_front_left">phiro front left sensor</string>
<string name="formula_editor_phiro_sensor_front_right">phiro front right sensor</string>
<string name="formula_editor_phiro_sensor_side_left">phiro side left sensor</string>
Expand Down

0 comments on commit 7126b1e

Please sign in to comment.