name: xtactics
title: xTactics
version: '1.4.0'
summary: A turn-based strategy game inspired by Risk board game.
description: |
  **Features:**
  * Zoom-able map.
  * Map can be generated in cyclic mode to simulate world without borders.
  * Application configuration stored in XML file.
  * Allows to save and load game to game file in XML format with extension .xtg.
  * Localization support (English, Czech)
  * High DPI support.
  * Multiple map cell shapes as hexagons, squares, triangles, isometric, and random mesh.
  * Bridges between remote cells visible as lines.
  * Multiple players support. Players can have different color and other starting properties.
  * Application automatically open saved game file given as command line parameter after execution.
  * Computer player settings to be low, medium or highly aggressive in attacking.
  * Use Shift key during mouse click to attack maximum available power is moved without dialog confirmation.
  * Use Control key during mouse click to move with maximum one time and repeated unit counts to selected target cell.
  * Game option "Fog of war" which cause map to be covered to black and only explored cells will be visible.
  * Auto save game to file option in settings.
  * Map shape can be selected as Rectangular, Rounded or mask from image file.
  * Support for symmetric map usable for two players game.
  * Confirmation dialog for ending game.
  * Support for switching large icons in toolbar.
  * Support for cities. Cities can configured to be used as only growing cells.
  * Allows to set grow rate as square root of cell power.
  * Amount of inaccessible cells can be adjusted in New game dialog.
  * Player mode human or computer.
  * Graph window can be shown from menu which presents development of various statistic values during game turns.
  * Load recent menu action to load recently opened/saved files.

confinement: strict
base: core24
grade: stable
icon: "Images/256x256/xtactics.png"
license: NLPL

parts:
  xtactics:
    plugin: nil
    source: .
    source-type: local
    build-packages:
    - fpc
    - lazarus
    - lcl
    - lcl-utils
    override-build: |
      snapcraftctl build
      lazbuild --build-mode=Release xtactics.lpi
      install -Dm755 xtactics -t $SNAPCRAFT_PART_INSTALL/usr/bin
      install -Dm644 Languages/*.po -t $SNAPCRAFT_PART_INSTALL/usr/share/xtactics/Languages
      install -Dm644 Packages/Common/Languages/*.po -t $SNAPCRAFT_PART_INSTALL/usr/share/xtactics/Languages
      install -Dm644 Packages/CoolStreaming/Languages/*.po -t $SNAPCRAFT_PART_INSTALL/usr/share/xtactics/Languages
      install -Dm644 Images/Maps/*.png -t $SNAPCRAFT_PART_INSTALL/usr/share/xtactics/Images/Maps
      install -Dm644 Systems/*.xts -t $SNAPCRAFT_PART_INSTALL/usr/share/xtactics/Systems
      install -Dm644 Install/deb/xtactics.desktop -t $SNAPCRAFT_PART_INSTALL/usr/share/applications
      install -Dm644 Install/deb/xtactics.xml -t $SNAPCRAFT_PART_INSTALL/usr/share/mime/packages
      install -Dm644 Images/256x256/xtactics.png -t $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps
      install -Dm644 Images/256x256/xtactics.png $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps/application-xtg.png
      install -Dm644 Images/256x256/xtactics.png $SNAPCRAFT_PART_INSTALL/usr/share/pixmaps/application-xts.png
    after:
    - desktop-gtk2
    - lazarus
    stage:
    - etc
    - usr
    - usr/bin
    - usr/share/xtactics
    - usr/share/applications/xtactics.desktop
    - usr/share/pixmaps
    stage-packages:
    - libatk1.0-0
    - libcairo2
    - libdatrie1
    - libfontconfig1
    - libfreetype6
    - libfribidi0
    - libgdk-pixbuf2.0-0
    - libgraphite2-3
    - libgtk2.0-0
    - libharfbuzz0b
    - libpango-1.0-0
    - libpangocairo-1.0-0
    - libpangoft2-1.0-0
    - libpixman-1-0
    - libpng16-16
    - libthai0
    - libx11-6
    - libxau6
    - libxcb-render0
    - libxcb-shm0
    - libxcb1
    - libxcomposite1
    - libxcursor1
    - libxdamage1
    - libxdmcp6
    - libxext6
    - libxfixes3
    - libxi6
    - libxinerama1
    - libxrandr2
    - libxrender1
    - libglu1-mesa

  lazarus:
    plugin: nil
    source: .
    source-type: local
    build-packages:
    - wget
    - libgtk2.0-dev
    override-build: |
      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.6/lazarus-project_3.6.0-0_amd64.deb
      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.6/fpc-laz_3.2.2-210709_amd64.deb
      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%203.6/fpc-src_3.2.2-210709_amd64.deb
      apt install ./lazarus-project_3.6.0-0_amd64.deb ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb
    stage: [-*]
    prime: [-*]

  desktop-gtk2:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: gtk
    plugin: make
    make-parameters: ["FLAVOR=gtk2"]
    build-packages:
    - build-essential
    - libgtk2.0-dev
    stage-packages:
    - libxkbcommon0  # XKB_CONFIG_ROOT
    #- ttf-ubuntu-font-family
    - dmz-cursor-theme
    - light-themes
    - adwaita-icon-theme
    #- gnome-themes-standard
    - shared-mime-info
    - libgtk2.0-0
    - libgdk-pixbuf2.0-0
    - libglib2.0-bin
    - libgtk2.0-bin
    - unity-gtk2-module
    - locales-all
    #- libappindicator1
    - xdg-user-dirs
    - ibus-gtk
    - libibus-1.0-5

# Additional plugs to pick up the GTK theme and icons from the system
plugs:
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  gtk-2-engines:
    interface: content
    target: $SNAP/lib/gtk-2.0
    default-provider: gtk2-common-themes:gtk-2-engines
  gtk-2-themes:
    interface: content
    target: $SNAP/usr/share/themes
    default-provider: gtk2-common-themes:gtk-2-themes

environment:
  XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
  GTK_PATH: $SNAP/lib/gtk-2.0

apps:
  xtactics:
    command: usr/bin/xtactics
    command-chain:
    - bin/desktop-launch
    desktop: usr/share/applications/xtactics.desktop
    plugs:
    - desktop
    - x11
    - home

layout:
  /usr/share/xtactics:
    bind: $SNAP/usr/share/xtactics
