Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f909673
chore: Massive update...
kkafar Apr 11, 2022
97168b4
BREAKING CHANGES: Arch proposal
kkafar Apr 12, 2022
eb85cb5
chore: rename io.rpg.torefract -> io.rpg.torefact
kkafar Apr 12, 2022
b5a0c8a
refact: rename PointsPopupController -> PointsPopupViewModel
kkafar Apr 13, 2022
b69f869
refact: add comments & change method names in ConfigLoader
kkafar Apr 13, 2022
8eb9b59
refact: add comments tgo GameObjectConfig
kkafar Apr 13, 2022
25a08a5
refact: add comments to GameWorldConfig
kkafar Apr 13, 2022
de086eb
chore: make ConfigLoader#{loadGameWorldConfig,loadLocationConfig}
kkafar Apr 13, 2022
a958a33
chore: add generic class describing operation result
kkafar Apr 13, 2022
f1219eb
chore: add Optional returning getters to Result
kkafar Apr 13, 2022
211f928
fix: revert changes from #de086eb
kkafar Apr 13, 2022
7fe4bd6
chore: update configuration files
kkafar Apr 13, 2022
e774cfb
chore: improve error handlign in config module via Result class
kkafar Apr 13, 2022
04292a5
feat: add helper methods to Result class
kkafar Apr 13, 2022
77279ff
chore: add builder to the Game class
kkafar Apr 13, 2022
2223fa0
refact: adapt Main to new Result based interface
kkafar Apr 13, 2022
4a27c40
feat: add builder to the Controller
kkafar Apr 13, 2022
41f013f
chore: update unit test configuration
kkafar Apr 13, 2022
a9d9c92
fix: make unit tests pass
kkafar Apr 13, 2022
f85525c
chore: Update observer schema before refractoring
kkafar Apr 13, 2022
58ed78f
Merge branch 'master' into @kkafar/arch-proposal
kkafar Apr 13, 2022
1af5380
docs: add more comments to GameWorldConfig
kkafar Apr 13, 2022
8f82497
chore: make GameObjectConfig#valide method return Result
kkafar Apr 13, 2022
8af785a
chore: Cleanup ConfigLoader
kkafar Apr 13, 2022
9f65d92
chore: minor fixes & apply linter
kkafar Apr 13, 2022
c900f2d
refact: apply style suggestions
kkafar Apr 13, 2022
52cc4f6
Merge branch 'master' into @kkafar/arch-proposal
kkafar Apr 13, 2022
448ab7e
chore: attempt to display game objects on screen
ksiek127 Apr 20, 2022
38c3f25
Merge branch 'master' into @ksiek127/RPG-84-display-objects-on-screen
ksiek127 Apr 20, 2022
662d640
chore: displaying objects on screen v1
ksiek127 Apr 21, 2022
d60e29d
chore: displaying objects on screen v2
ksiek127 Apr 23, 2022
ef4db38
Merge branch 'development' into @ksiek127/RPG-84-display-objects-on-s…
kkafar Apr 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tag": "object-1",
"assetPath": "/path/to/the/asset",
"type": ""
"assetPath": "assets/stone.png",
"type": "",
"x": 150,
"y": 200
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tag": "object-2",
"assetPath": "assets/stone.png",
"type": "",
"x": 50,
"y": 100
}
15 changes: 14 additions & 1 deletion src/main/java/io/rpg/view/LocationView.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package io.rpg.view;

import io.rpg.Game;
import io.rpg.Initializer;
import io.rpg.config.model.GameObjectConfig;
import io.rpg.model.data.KeyboardEvent;
import io.rpg.model.data.LocationModelStateChange;
import io.rpg.model.location.LocationModel;
import io.rpg.model.object.GameObject;
import io.rpg.viewmodel.LocationViewModel;
import io.rpg.config.model.LocationConfig;
import javafx.fxml.FXMLLoader;
Expand All @@ -16,7 +21,10 @@
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.util.ArrayList;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class LocationView extends Scene
Expand All @@ -28,7 +36,7 @@ public class LocationView extends Scene

private final Set<KeyboardEvent.Observer> onKeyPressedObservers;

private final LocationViewModel viewModel;
private static LocationViewModel viewModel;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dlaczego static? Wydaje mi się, że niepotrzebnie.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wlasnie tez nad tym myslalem
dalem static, bo uzywam tego w fromConfig(), ktore jest statyczne
ale nie jestem pewny czy lepiej zrobic to pole statyczne czy np je przekazac do tej metody jako parametr


public LocationView(HBox root, LocationViewModel viewModel) {
super(root);
Expand Down Expand Up @@ -63,6 +71,11 @@ public static LocationView fromConfig(LocationConfig config) throws IOException
System.out.println(config.getBackgroundPath());
view.getViewModel().setBackground(new Image(resolvePathToJFXFormat(config.getBackgroundPath())));
// todo: na podstawie configu ustawić pola korzystając z view modelu
List<GameObjectConfig> objectConfigs = config.getObjects();
for(GameObjectConfig objectConfig : objectConfigs) {
GameObjectView goview = new GameObjectView(Path.of(objectConfig.getAssetPath()), objectConfig.getPosition());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pozycję w postaci numeru wiersza i kolumny trzeba jeszcze przeskalować przez rozmiar kwadratu siatki. raczej nie w tym miejscu, ale gdzieś trzeba

viewModel.addChild(goview);
}
return view;
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/io/rpg/viewmodel/LocationViewModel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.rpg.viewmodel;

import io.rpg.model.object.GameObject;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
Expand All @@ -8,6 +9,7 @@
import javafx.scene.layout.Pane;

import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;

public class LocationViewModel implements Initializable {
Expand Down Expand Up @@ -45,4 +47,8 @@ public void initialize(URL location, ResourceBundle resources) {
mapImageView.setFitHeight(newImg.getHeight());
});
}

public void addChild(ImageView child) {
parent.getChildren().add(child);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tak jak jest obecnie obrazki są rysowane obok tła, zamiast na nim. zmiana parent na contentPane chyba załatwia sprawę

Suggested change
parent.getChildren().add(child);
contentPane.getChildren().add(child);

}
}