Skip to content

Commit

Permalink
add todo
Browse files Browse the repository at this point in the history
  • Loading branch information
svencc committed Jan 31, 2024
1 parent 3f81569 commit 5414f62
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 1
* new InputComponent interacting with MapComponent
* (map) zooming
* add pre-click-event (preclick, click, doublecklic) events
* add sortable physics modifier components
* (gravity)
* loosing movement speed to zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class JavaFxMouseButtonCommandMapper implements IsInputCommandMapper<IsMo
private final LinkedList<IsMouseButtonEventFSM> mouseButtonEventFSMs = new LinkedList<>();

public JavaFxMouseButtonCommandMapper() {
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(150), MouseButton.PRIMARY));
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(150), MouseButton.SECONDARY));
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(150), MouseButton.MIDDLE));
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(175), MouseButton.PRIMARY));
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(175), MouseButton.SECONDARY));
mouseButtonEventFSMs.add(new MouseButtonEventFSM2(Duration.ofMillis(150),Duration.ofMillis(175), MouseButton.MIDDLE));

startMachines();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.recom.commander.configuration;

import com.recom.commander.enginemodule.entity.RECOMMapEntity;
import com.recom.commander.enginemodule.entity.component.RECOMMapComponent;
import com.recom.commander.enginemodule.entity.component.RECOMMapInputComponent;
import com.recom.commander.enginemodule.entity.recommapentity.RECOMMapEntity;
import com.recom.commander.enginemodule.entity.recommapentity.component.RECOMMapComponent;
import com.recom.commander.enginemodule.entity.recommapentity.component.RECOMMapInputComponent;
import com.recom.tacview.engine.entitycomponentsystem.component.PhysicComponent;
import com.recom.tacview.engine.entitycomponentsystem.component.PhysicCoreComponent;
import lombok.NonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.recom.commander.enginemodule;

import com.recom.commander.enginemodule.entity.RECOMMapEntity;
import com.recom.commander.enginemodule.entity.recommapentity.RECOMMapEntity;
import com.recom.tacview.engine.entitycomponentsystem.environment.Environment;
import com.recom.tacview.engine.module.EngineModule;
import lombok.NonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.recom.commander.enginemodule.entity;
package com.recom.commander.enginemodule.entity.recommapentity;

import com.recom.tacview.engine.entitycomponentsystem.entity.Entity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.recom.commander.enginemodule.entity.component;
package com.recom.commander.enginemodule.entity.recommapentity.component;

import com.recom.commander.event.InitialAuthenticationEvent;
import com.recom.commander.mapper.HeightMapDescriptorMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.recom.commander.enginemodule.entity.component;
package com.recom.commander.enginemodule.entity.recommapentity.component;

import com.recom.tacview.engine.entitycomponentsystem.component.ComponentType;
import com.recom.tacview.engine.entitycomponentsystem.component.InputComponent;
Expand All @@ -20,7 +20,7 @@
public class RECOMMapInputComponent extends InputComponent {

private static final float velocityX = 140f;
private static final int DRAG_SPEED_COEFICIENT = 4;
private static final int DRAG_SPEED_COEFFICIENT = 4;


@Override
Expand All @@ -44,14 +44,14 @@ public void handleInputCommand(@NonNull final IsCommand<?> inputCommand) {
// code to zoom in/out
}
case MouseDragCommand mouseDragCommand -> {
if (mouseDragCommand.getMouseButton().equals(MouseButton.MIDDLE)) {
if (mouseDragCommand.getMouseButton().equals(MouseButton.SECONDARY)) {
this.getEntity().<PhysicCoreComponent>locateComponent(ComponentType.PhysicsCoreComponent).ifPresent(physicsCoreComponent -> {
if (mouseDragCommand.isInOriginPosition()) {
physicsCoreComponent.setVelocityXComponent(0);
physicsCoreComponent.setVelocityYComponent(0);
} else {
physicsCoreComponent.setVelocityXComponent(-1 * mouseDragCommand.getDistanceX() * DRAG_SPEED_COEFICIENT);
physicsCoreComponent.setVelocityYComponent(-1 * mouseDragCommand.getDistanceY() * DRAG_SPEED_COEFICIENT);
physicsCoreComponent.setVelocityXComponent(-1 * mouseDragCommand.getDistanceX() * DRAG_SPEED_COEFFICIENT);
physicsCoreComponent.setVelocityYComponent(-1 * mouseDragCommand.getDistanceY() * DRAG_SPEED_COEFFICIENT);
}
});
} else {
Expand Down

0 comments on commit 5414f62

Please sign in to comment.