use of capslock.game_info.Game in project CapsLock by chrootRISCassembler.
the class MainFormController method onPanelClicked.
void onPanelClicked(MouseEvent event) {
// 右クリックじゃない
if (!event.getButton().equals(MouseButton.PRIMARY))
return;
// クリックされたパネルの取得
final ImageView view = (ImageView) event.getSource();
// パネルが示すゲーム
final Game NextGame = (Game) view.getUserData();
if (game != NextGame) {
PanelTilePane.getChildren().stream().peek(panel -> panel.setScaleX(1)).peek(panel -> panel.setScaleY(1)).forEach(panel -> panel.setEffect(null));
{
// 選択されたパネルにエフェクトを適応
view.setScaleX(1.15);
view.setScaleY(1.15);
// 影つけて
final DropShadow effect = new DropShadow(20, Color.BLUE);
// 光らせる
effect.setInput(new Glow(0.5));
view.setEffect(effect);
}
game = NextGame;
Logger.INST.debug("ContentsAreaController#setGame() call");
contentsAreaController.setGame(game);
{
final String name = NextGame.getName();
NameLabel.setText("[P-" + NextGame.getGameID() + "]" + name);
}
if (NextGame.getDesc() == null) {
Logger.INST.debug("No desc!");
}
DescriptionLabel.setText(NextGame.getDesc());
DescriptionLabel.setPadding(Insets.EMPTY);
DescriptionLabel.autosize();
}
// ダブルクリックじゃない
if (event.getClickCount() != 2)
return;
handler.launch(game);
}
use of capslock.game_info.Game in project CapsLock by chrootRISCassembler.
the class MainFormController method onCreated.
void onCreated(MainHandler handler) {
this.handler = handler;
final double PanelImageSideLength;
Logger.INST.debug("Start calculation of dynamic UI.");
{
final Rectangle2D ScreenRect = Screen.getPrimary().getVisualBounds();
final double FullScreenWidth = ScreenRect.getWidth();
final double FullScreenHeight = ScreenRect.getHeight();
final double LeftSize = FullScreenWidth / 5 * 2;
LeftScrollPane.setPrefViewportWidth(LeftSize);
LeftScrollPane.setMinViewportWidth(LeftSize);
PanelImageSideLength = LeftSize * PANEL_RATIO;
final double Gap = LeftSize * PANEL_GAP_RATIO;
PanelTilePane.setPadding(new Insets(LeftSize / 12));
PanelTilePane.setVgap(Gap);
PanelTilePane.setHgap(Gap);
final double RightContentPadding = (FullScreenWidth - LeftSize) / 20;
RightVBox.setPadding(new Insets(RightContentPadding));
RightVBox.setMaxWidth(FullScreenWidth - LeftSize);
NameLabel.setFont(Font.font(FullScreenHeight / 20));
DescriptionLabel.setFont(Font.font(FullScreenHeight / 40));
}
Logger.INST.debug("Finished calculation of dynamic UI.");
final ColorSequencer sequencer = new ColorSequencer();
final Tooltip tooltip = new Tooltip("ダブルクリックでゲーム起動");
for (final Game game : handler.getGameList()) {
final Image panelImage;
final Path panelPath = game.getPanel();
if (panelPath == null) {
panelImage = CharPanelGenerator.generate(game.getName().charAt(0), sequencer.get());
} else {
panelImage = new Image(panelPath.toUri().toString());
}
final ImageView view = new ImageView(panelImage);
view.setPreserveRatio(false);
view.setFitWidth(PanelImageSideLength);
view.setFitHeight(PanelImageSideLength);
view.setOnMouseClicked(eve -> onPanelClicked(eve));
Tooltip.install(view, tooltip);
view.setUserData(game);
PanelTilePane.getChildren().add(view);
}
contentsAreaController = new ContentsAreaController(ViewStackPane, StackedMediaView, StackedImageView);
Logger.INST.debug("MainForm window is displayed.");
System.gc();
}
Aggregations