summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.classpath6
-rw-r--r--.project17
-rw-r--r--ColorsMemory.desktop14
-rw-r--r--CzytajTo.docxbin0 -> 4929 bytes
-rw-r--r--DEBIAN/HOWTO.txt2
-rw-r--r--DEBIAN/colorsmemory-0.210503-1.tar.gzbin0 -> 59147 bytes
-rw-r--r--DEBIAN/colorsmemory.dsc40
-rw-r--r--DEBIAN/debian.changelog5
-rw-r--r--DEBIAN/debian.changelog.txt5
-rw-r--r--DEBIAN/debian.control13
-rw-r--r--DEBIAN/debian.control.txt13
-rw-r--r--DEBIAN/debian.rules24
-rwxr-xr-xDEBIAN/format.sh2
-rw-r--r--Makefile19
-rw-r--r--Makefile.aur20
-rw-r--r--PKG/PKGBUILD23
-rw-r--r--RPM/colorsmemory.spec66
-rw-r--r--build.xml25
-rw-r--r--colorsmemory.pngbin0 -> 4582 bytes
-rw-r--r--colorsmemory.xcfbin0 -> 8999 bytes
-rw-r--r--makefile19
-rw-r--r--src/ColorsMemory.java310
-rw-r--r--src/Field.java41
-rw-r--r--wrapper-icon/Icon.rc1
-rw-r--r--wrapper-icon/Makefile.old.win33
-rw-r--r--wrapper-icon/Makefile.win36
-rw-r--r--wrapper-icon/config.txt1
-rw-r--r--wrapper-icon/icon/Jttt.icobin0 -> 2686 bytes
-rw-r--r--wrapper-icon/icon/Trefle.icobin0 -> 47826 bytes
-rw-r--r--wrapper-icon/icon/colorsmemory.icobin0 -> 2686 bytes
-rw-r--r--wrapper-icon/icon/ufo-small.icobin0 -> 2190 bytes
-rw-r--r--wrapper-icon/wrapper.c71
32 files changed, 806 insertions, 0 deletions
diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..0cbf9cd
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/.project b/.project
new file mode 100644
index 0000000..f54e595
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>colorsmemory</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/ColorsMemory.desktop b/ColorsMemory.desktop
new file mode 100644
index 0000000..b19fbee
--- /dev/null
+++ b/ColorsMemory.desktop
@@ -0,0 +1,14 @@
+#!/usr/bin/env xdg-open
+
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Categories=Game;
+
+Name=Colors Memory
+
+Exec=java -jar /usr/bin/ColorsMemory.jar
+Terminal=false
+Icon=/usr/share/colorsmemory/colorsmemory.png
+
+Name[pl_PL]=Colors Memory
diff --git a/CzytajTo.docx b/CzytajTo.docx
new file mode 100644
index 0000000..db0fc98
--- /dev/null
+++ b/CzytajTo.docx
Binary files differ
diff --git a/DEBIAN/HOWTO.txt b/DEBIAN/HOWTO.txt
new file mode 100644
index 0000000..a371e0b
--- /dev/null
+++ b/DEBIAN/HOWTO.txt
@@ -0,0 +1,2 @@
+foramt zapisu nazwy pliku:
+ photocrop_0.221225-0~alpha.tar.gz
diff --git a/DEBIAN/colorsmemory-0.210503-1.tar.gz b/DEBIAN/colorsmemory-0.210503-1.tar.gz
new file mode 100644
index 0000000..7e0571c
--- /dev/null
+++ b/DEBIAN/colorsmemory-0.210503-1.tar.gz
Binary files differ
diff --git a/DEBIAN/colorsmemory.dsc b/DEBIAN/colorsmemory.dsc
new file mode 100644
index 0000000..6fbe340
--- /dev/null
+++ b/DEBIAN/colorsmemory.dsc
@@ -0,0 +1,40 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+Format: 1.0
+Source: colorsmemory
+Binary: colorsmemory
+Architecture: all
+Version: 0.210503-2
+Maintainer: Przemysław R. Pietraszczyk <prymula76@outlook.com>
+Homepage: https://prymula.ct8.pl
+DEBTRANSFORM-TAR: colorsmemory-0.210503-2.tar.gz
+
+Standards-Version: 0.210503-2
+Build-Depends: debhelper-compat (>= 12), default-jdk, default-jdk-headless, fakeroot, ant
+Package-List:
+colorsmemory deb x11 optional arch=all
+Files:
+ b31649bc23b2b7bca9ab70ea3410711a 128820 colorsmemory-0.210503-2.tar.gz
+ 29e7e7e60bc81891e3da3871b9eeb549 764 colorsmemory-0.210503-2.debian.tar.xz
+
+-----BEGIN PGP SIGNATURE-----
+
+mQENBGEf/c4BCAC2d4ymW0pRZV36qLtlt/WGb83kos5UX5UbwvkQrbUjAbOPOY8w
+DT3M1neYOAPZx38924aPTFKbZPcz+rK/7Wcv1kzgfux5zXQJTLeqpkhUYAgXUg2p
+oK9ZXsai82fOicTrClOyJLLYQ8C1vj8yUh7e3ERljEyp5Nxg/lY92rwcZ4WYR193
+nGDInlDl5JlWUcLlk/RFnC5bB+T6ZZr5FBX/eDnKAPEl+N3MWpDs2JLDy7EUPhcG
+U/60X0wuXHPTwMoNbB3ep/bWRxwEej0sFad5GXeCh7hKCroi/kLmLTDIxSD8lsRr
+Y4H/8H2lBBsQq7bRL88N6ZDGCocPo11V83kFABEBAAG0NmhvbWU6cHJ6ZW0gT0JT
+IFByb2plY3QgPGhvbWU6cHJ6ZW1AYnVpbGQub3BlbnN1c2Uub3JnPokBPgQTAQgA
+KAUCYR/9zgIbAwUJBB6wAAYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQcXEc
+NPcNefFEAAf+Kg4cs/C99kEIMv/PO85VW+p8rcTwCViOFUX5WrBhwsRyPAKrJPPG
+KD6PdnvoplcNQwhQ8nRsRiiaiUtPcj8Bvi6EdPgSgXXObKKJtCyaAa1rURdlb9iW
+CfvXA6oW+PGlii9BMnXOAtkeFIzZooO9oXd+wez66P+4VWFiFzxanLfLn/hwbWxQ
+68rlO3QNGbrMeODBgwh9s83XGmAg47mn2fldTAmTbJDf9tMi1LhX2MmLyN9wjqsd
+4IZ9JMri2JTnIhYfxWdKT9gsu7q0g8LqonaXMvlOEyHFRF1YQ0i7G6fFbvDcKCZN
+W1Eja55FdN7smv5Eck6UTIIYyWPuAv45uohGBBMRAgAGBQJhH/3PAAoJEDswEbdr
+nWUj4M0AniJ389dyvUjjgS91AcOb08E4moV9AJ9WDL3/7GYYUL/Azw43QucWPnXr
+uw==
+=+lfH
+-----END PGP SIGNATURE-----
diff --git a/DEBIAN/debian.changelog b/DEBIAN/debian.changelog
new file mode 100644
index 0000000..2171d74
--- /dev/null
+++ b/DEBIAN/debian.changelog
@@ -0,0 +1,5 @@
+colorsmemory (0.210503-0) unstable; urgency=low
+
+ * Last release
+
+ -- Przemysław R. Pietraszczyk Sat, 25 Dec 2022 08:31:41 +0200
diff --git a/DEBIAN/debian.changelog.txt b/DEBIAN/debian.changelog.txt
new file mode 100644
index 0000000..2171d74
--- /dev/null
+++ b/DEBIAN/debian.changelog.txt
@@ -0,0 +1,5 @@
+colorsmemory (0.210503-0) unstable; urgency=low
+
+ * Last release
+
+ -- Przemysław R. Pietraszczyk Sat, 25 Dec 2022 08:31:41 +0200
diff --git a/DEBIAN/debian.control b/DEBIAN/debian.control
new file mode 100644
index 0000000..b452fcd
--- /dev/null
+++ b/DEBIAN/debian.control
@@ -0,0 +1,13 @@
+Source: colorsmemory
+Section: java
+Priority: extra
+Maintainer: Przemysław R. Pietraszczyk
+Build-Depends: debhelper-compat (= 12), default-jdk, default-jdk-headless, fakeroot, ant
+Standards-Version: 0.210503-2
+Homepage: https://prymula.ct8.pl
+
+
+Package: colorsmemory
+Architecture: all
+Depends: ${misc:Depends}, default-jdk | default-jre
+Description: My implementation Memory game
diff --git a/DEBIAN/debian.control.txt b/DEBIAN/debian.control.txt
new file mode 100644
index 0000000..7d5bc4c
--- /dev/null
+++ b/DEBIAN/debian.control.txt
@@ -0,0 +1,13 @@
+Source: colorsmemory
+Section: java
+Priority: extra
+Maintainer: Przemysław R. Pietraszczyk
+Build-Depends: debhelper-compat (= 13), openjdk-11-jdk, openjdk-11-jdk-headless, fakeroot, ant
+Standards-Version: 0.210503-1
+Homepage: https://prymula.ct8.pl
+
+
+Package: colormemory
+Architecture: all
+Depends: ${misc:Depends}, openjdk-11-jdk | openjdk-11-jre
+Description: My implementation Memory game
diff --git a/DEBIAN/debian.rules b/DEBIAN/debian.rules
new file mode 100644
index 0000000..20b6b3b
--- /dev/null
+++ b/DEBIAN/debian.rules
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+
+export DH_VERBOSE = 1
+#export PYBUILD_NAME = photocrop
+#export PYBUILD_SYSTEM = custom
+
+clean:
+ ant clean
+
+build:
+ ant compile
+ ant jar
+
+binary:
+ mkdir -pm 0755 debian/colormemory
+ mkdir -pm 0755 debian/colorsmemory/usr/bin
+ mkdir -pm 0755 debian/colorsmemory/usr/share/colorsmemory
+ mkdir -pm 0755 debian/colorsmemory/usr/share/applications
+ cp build/jar/ColorsMemory.jar debian/colorsmemory/usr/bin
+ cp colorsmemory.png debian/colorsmemory/usr/share/colorsmemory
+ cp ColorsMemory.desktop debian/colorsmemory/usr/share/applications
+ dh_gencontrol
+ dh_builddeb
+
diff --git a/DEBIAN/format.sh b/DEBIAN/format.sh
new file mode 100755
index 0000000..49e73ab
--- /dev/null
+++ b/DEBIAN/format.sh
@@ -0,0 +1,2 @@
+mkdir ./exec
+exec /usr/lib/build/debtransform ./ ./colorsmemory.dsc ./exec
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b9db164
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+# Link command:
+#choinka: engin.o
+# gcc engin.o -o choinka
+
+# Compilation commands:
+#engin.o: engin.c
+# gcc -c engin.c -o engin.o
+
+
+prefix=/usr
+
+install: build/jar/ColorsMemory.jar
+ install -m 0644 build/jar/ColorsMemory.jar $(prefix)/games
+ mkdir -pm 0755 $(prefix)/share/colorsmemory
+ mkdir -pm 0755 $(prefix)/share/colorsmemory/icons
+ install -m 0644 colorsmemory.png $(prefix)/share/colorsmemory/icons
+ install -m 0644 ColorsMemory.desktop /usr/share/applications
+
+.PHONY: install
diff --git a/Makefile.aur b/Makefile.aur
new file mode 100644
index 0000000..ceef523
--- /dev/null
+++ b/Makefile.aur
@@ -0,0 +1,20 @@
+
+prefix=/usr
+
+all:
+ ant compile
+ ant jar
+
+clean:
+ ant clean
+
+install: build/jar/ColorsMemory.jar
+ mkdir -pm 0755 $(DESTDIR)$(prefix)/games
+ mkdir -pm 0755 $(DESTDIR)$(prefix)/share/applications
+ mkdir -pm 0755 $(DESTDIR)$(prefix)/share/colorsmemory
+ mkdir -pm 0755 $(DESTDIR)$(prefix)/share/colorsmemory/icons
+ install -m 0644 build/jar/ColorsMemory.jar $(DESTDIR)$(prefix)/games
+ install -m 0644 colorsmemory.png $(DESTDIR)$(prefix)/share/colorsmemory/icons
+ install -m 0644 ColorsMemory.desktop $(DESTDIR)$(prefix)/share/applications
+
+.PHONY: install
diff --git a/PKG/PKGBUILD b/PKG/PKGBUILD
new file mode 100644
index 0000000..8a2e21e
--- /dev/null
+++ b/PKG/PKGBUILD
@@ -0,0 +1,23 @@
+# Maintainer: Przemyslaw R. Pietraszczyk <prymula76@outlook.com>
+
+pkgname=colorsmemory
+pkgver=0.210503
+pkgrel=2
+pkgdesc="My implementation Memory game"
+arch=('any')
+url="prymula.ct8.pl"
+license=('GPL3')
+provides=('colorsmemory')
+depends=('jdk-openjdk')
+makedepends=('jdk-openjdk' 'ant')
+source=("${pkgname}-${pkgver}-${pkgrel}.tar.gz::file://${pkgname}-${pkgver}-${pkgrel}.tar.gz")
+sha256sums=('169cb0d635a2e231ab9a4f752a4c9e58409b48fe50895459107f7163bdfa3948') #generate with 'makepkg -g' || sha256sum
+build() {
+ cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}"
+ make -f Makefile.aur
+}
+
+package() {
+ cd "$srcdir/${pkgname}-${pkgver}-${pkgrel}"
+ make -f Makefile.aur DESTDIR="${pkgdir}" install
+}
diff --git a/RPM/colorsmemory.spec b/RPM/colorsmemory.spec
new file mode 100644
index 0000000..0a92fb1
--- /dev/null
+++ b/RPM/colorsmemory.spec
@@ -0,0 +1,66 @@
+#
+# spec file for package colorsmemory
+#
+# Copyright (c) 2020 SUSE LLC
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
+
+%define unmangled_version 0.210503-2
+Name: colorsmemory
+Version: 0.210503
+Release: 2
+Summary: My implementation Memory game
+License: GPL
+URL: https://prymula.ct8.pl
+Source0: %{name}-%{unmangled_version}.tar.gz
+%if 0%{?suse_version}==1530
+BuildRequires: java-11-openjdk, ant
+Requires: java-11-openjdk
+%else
+BuildRequires: java-11-openjdk, ant
+Requires: java-11-openjdk
+%endif
+BuildArch: noarch
+
+%description
+
+
+%prep
+%setup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version}
+
+%build
+ant compile
+ant jar
+
+%install
+mkdir -p %{buildroot}/usr
+mkdir -p %{buildroot}/usr/bin
+mkdir -p %{buildroot}/usr/share
+mkdir -p %{buildroot}/usr/share/colorsmemory
+mkdir -p %{buildroot}/usr/share/applications
+
+#%make_install
+
+install -m 0644 build/jar/ColorsMemory.jar %{buildroot}/usr/bin
+install -m 0644 colorsmemory.png %{buildroot}/usr/share/colorsmemory
+install -m 0644 ColorsMemory.desktop %{buildroot}/usr/share/applications
+
+%files
+%defattr(0755,root,root)
+%{_datadir}/colorsmemory
+%defattr(0644,root,root)
+/usr/bin/ColorsMemory.jar
+%{_datadir}/colorsmemory/colorsmemory.png
+%{_datadir}/applications/ColorsMemory.desktop
+
+%changelog
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..c674970
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,25 @@
+<project>
+
+ <target name="clean">
+ <delete dir="build"/>
+ </target>
+
+ <target name="compile">
+ <mkdir dir="build/classes"/>
+ <javac srcdir="src" destdir="build/classes"/>
+ </target>
+
+ <target name="jar">
+ <mkdir dir="build/jar"/>
+ <jar destfile="build/jar/ColorsMemory.jar" basedir="build/classes">
+ <manifest>
+ <attribute name="Main-Class" value="ColorsMemory"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run">
+ <java jar="build/jar/ColorsMemory.jar" fork="true"/>
+ </target>
+
+</project>
diff --git a/colorsmemory.png b/colorsmemory.png
new file mode 100644
index 0000000..c68f2df
--- /dev/null
+++ b/colorsmemory.png
Binary files differ
diff --git a/colorsmemory.xcf b/colorsmemory.xcf
new file mode 100644
index 0000000..bcc9990
--- /dev/null
+++ b/colorsmemory.xcf
Binary files differ
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..ed10fc2
--- /dev/null
+++ b/makefile
@@ -0,0 +1,19 @@
+# Link command:
+#choinka: engin.o
+# gcc engin.o -o choinka
+
+# Compilation commands:
+#engin.o: engin.c
+# gcc -c engin.c -o engin.o
+
+
+prefix=/usr/local
+
+install: build/jar/ColorsMemory.jar
+ install -m 0755 build/jar/ColorsMemory.jar $(prefix)/games
+ mkdir -pm 0777 $(prefix)/share/colorsmemory_jar
+ mkdir -pm 0777 $(prefix)/share/colorsmemory_jar/icons
+ install -m 0755 colorsmemory.png $(prefix)/share/colorsmemory_jar/icons
+ install -m 0755 ColorsMemory.desktop /usr/share/applications
+
+.PHONY: install
diff --git a/src/ColorsMemory.java b/src/ColorsMemory.java
new file mode 100644
index 0000000..0e11fef
--- /dev/null
+++ b/src/ColorsMemory.java
@@ -0,0 +1,310 @@
+import java.awt.*; // Toolkit
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+//import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JMenuBar;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.Box;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.util.Timer;
+import java.util.*; //Timer
+import java.lang.*;
+
+public class ColorsMemory extends JPanel
+ implements ActionListener {
+ static JMenuBar menuBar;
+ JMenu menu, info;
+ JMenuItem menuItem, menuExit, menuInfo;
+ static final int NW=4, NH=4; // weight - height
+ static JFrame frame;
+ static Timer timer;
+ static Field [][]field = new Field[NH][NW];
+ static int []tmpi = new int[2];
+ static int []tmpj = new int[2];
+ static boolean showColor=false;
+ static boolean press=false;
+ static boolean lockClick=false;
+ static int nmove=0;
+ static int nFields; // ilosc pozostalych pol do odkrycia
+ static JLabel label = new JLabel("Witaj w Colors Memory!");
+
+ public ColorsMemory() {
+ super(new GridBagLayout());
+ GridBagLayout gridbag = (GridBagLayout)getLayout();
+ GridBagConstraints c = new GridBagConstraints();
+ int i;
+ int j;
+ // int x, y;
+ int k=0;
+
+ menuBar = new JMenuBar();
+ menu = new JMenu("Plik");
+ menuBar.add(menu);
+ // przenosi INFO na prawa strone
+ menuBar.add(Box.createHorizontalGlue());
+ info = new JMenu("Info");
+ info.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ menuBar.add(info);
+ menuItem = new JMenuItem("Nowa Gra", null);
+ menuItem.setActionCommand("NewGame");
+ menuItem.addActionListener(this);
+ menuItem.setToolTipText("Rozpoczyna nowa gre");
+ menu.add(menuItem);
+ menu.addSeparator();
+ menuItem = new JMenuItem("Zakoncz", null);
+ menuItem.setActionCommand("Exit");
+ menuItem.addActionListener(this);
+ menuItem.setToolTipText("Wyjscie z programu");
+ menu.add(menuItem);
+ menuItem = new JMenuItem("O Programie", null);
+ menuItem.setActionCommand("About");
+ menuItem.addActionListener(this);
+ menuItem.setToolTipText("Informacje o programie");
+ info.add(menuItem);
+
+ for (i=0;i<NH;i++) {
+ for (j = 0; j < NW; j++, k++) {
+ field[i][j] = new Field(i, j);
+ field[i][j].button.setActionCommand("colorButton"+k);
+ field[i][j].button.addActionListener(this);
+ }
+ }
+ init();
+
+ for (i=0;i<NH;i++) {
+ for (j=0;j<NW;j++,k++) {
+ field[i][j].button.setPreferredSize(new Dimension(60, 60));
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridx = j;
+ c.gridy = i;
+ gridbag.setConstraints(field[i][j].button, c);
+ field[i][j].button.setBackground(field[i][j].getColor());
+ //field[i][j].button.setForeground(field[i][j].getColorHide());
+ add(field[i][j].button);
+
+ //field[i][j].button.setActionCommand("colorButton"+k);
+ //field[i][j].button.addActionListener(this);
+ field[i][j].button.setFont(new Font("Arial", Font.PLAIN, 40));
+
+
+ }
+ }
+ label.setPreferredSize(new Dimension(100, 20));
+ c.fill = GridBagConstraints.HORIZONTAL;
+ c.gridwidth = 4;
+ c.gridx = 0;
+ c.gridy = 4;
+ gridbag.setConstraints(label, c);
+ add(label);
+ }
+ private void init(){
+ int i,j,x,y,k=0;
+ Random rand = new Random();
+ int cc=-1;
+ final int []r={64,96,128,0,178,196,255,0};
+ final int []g={64,0,0,32,16,128,255,128};
+ final int []b={0,45,128,128,64,32,0,255};
+
+ for (i=0;i<NH;i++) {
+ for (j = 0; j < NW; j++, k++) {
+ do {
+ y = rand.nextInt(NH);
+ x = rand.nextInt(NW);
+ //System.out.println("Rand y:"+y+" x:"+x);
+ } while (field[y][x].postReserve);
+ if (!field[y][x].postReserve) {
+ //field[y][x].reserve = true;
+
+ if (k % 2 == 0) cc++;
+ field[y][x].setColorHide(r[cc], g[cc], b[cc]);
+ field[y][x].postReserve = true;
+ //field[y][x].button.setForeground(field[y][x].getColorHide());
+
+ }
+ }
+ }
+ nFields=k;
+
+ }
+ public void actionPerformed(ActionEvent e){
+ int k=0;
+ if (!lockClick) {
+ for (int i = 0; i < NH; i++) {
+ for (int j = 0; j < NW; j++, k++) {
+ if (e.getActionCommand().equals("colorButton"+k)) {
+
+ // kliknieto pierwszy kafel
+ if (!press) {
+
+ if (!field[i][j].getFound()) {
+ //Toolkit.getDefaultToolkit().beep();
+ field[i][j].button.setBackground(field[i][j].getColorHide());
+ System.out.println("i: " + i + " j: " + j);
+ tmpi[0] = i;
+ tmpj[0] = j;
+ press = true;
+ nmove++;
+ }
+ // kliknieto drugi kafel
+ } else {
+ if ((!field[i][j].getFound()) && (tmpi[0]!=i || tmpj[0]!=j)) {
+ field[i][j].button.setBackground(field[i][j].getColorHide());
+ //System.out.println("i: " + i + " j: " + j + " found: " + field[i][j].getFound());
+ tmpi[1] = i;
+ tmpj[1] = j;
+
+ showColor = true;
+ press = false;
+ lockClick = true;
+
+ if (field[tmpi[0]][tmpj[0]].getColorHide().toString().equals(field[tmpi[1]][tmpj[1]].getColorHide().toString())) {
+
+ Toolkit.getDefaultToolkit().beep();
+ //System.out.println("K O L O R: "+field[tmpi[0]][tmpj[0]].getColorHide().toString());
+ label.setText(" Odnaleziono !");
+
+ field[tmpi[0]][tmpj[0]].setFound(true);
+ field[tmpi[1]][tmpj[1]].setFound(true);
+ }
+ else label.setText(" Pudlo !");
+ }
+ else {
+ System.out.println("Ten sam klocek");
+ // tutaj nic nie dopisujemy ! ponizsza linia jest zla!
+ //field[tmpi[0]][tmpj[0]].button.setBackground(field[tmpi[0]][tmpj[0]].getColor());
+ }
+ }
+ }
+ }
+ }
+ }
+ if(e.getActionCommand().equals("NewGame")) {
+ int i,j;
+
+ for (i=0;i<NH;i++) {
+ for (j = 0; j < NW; j++, k++) {
+
+ field[i][j].setFound(false);
+ //field[i][j].reserve = false;
+ field[i][j].postReserve = false;
+ field[i][j].button.setText("?");
+ }
+ }
+ init();
+ nmove=0;
+ }
+ else if(e.getActionCommand().equals("Exit")) {
+ System.exit(0);
+ }
+ else if(e.getActionCommand().equals("About")) {
+
+ JOptionPane.showMessageDialog(frame,
+ "Moja implementacja gry Memory\nPrzemyslaw R. Pietraszczyk\nStworzono w oparciu o OpenJDK\nSierpien 2019",
+ "Colors Memory 0.210503-0",
+ JOptionPane.PLAIN_MESSAGE);
+
+ }
+ /*
+ try {
+ mySleep();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ */
+ }
+ /*
+ private static void mySleep() throws InterruptedException{
+ Thread.sleep(1000);
+ }
+ */
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame("Colors Memory");
+ timer = new Timer();
+ int frameWidth = 300;
+ int frameHeight = 400;
+ // ustawia okno po prawe na dole
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ frame.setBounds((int) screenSize.getWidth()/2 - frameWidth/2,
+ (int) screenSize.getHeight() - frameHeight, frameWidth, frameHeight);
+ frame.setResizable(false);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ //Create and set up the content pane.
+ JComponent newContentPane = new ColorsMemory();
+ newContentPane.setOpaque(true); //content panes must be opaque
+ frame.setJMenuBar(menuBar);
+ frame.setContentPane(newContentPane);
+
+
+ //Display the window.
+ frame.pack();
+ frame.setVisible(true);
+
+ timer.schedule(new ClearField(), 2000, 3000);
+
+ }
+ public static void main(String[] args) {
+ //Schedule a job for the event-dispatching thread:
+ //creating and showing this application's GUI.
+ javax.swing.SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ }
+
+ static class ClearField extends TimerTask {
+ public void run() {
+ if (nFields!=0) {
+ if (showColor) {
+ System.out.println("show color");
+ press = false;
+ field[tmpi[0]][tmpj[0]].button.setBackground(field[tmpi[0]][tmpj[0]].getColor());
+ field[tmpi[1]][tmpj[1]].button.setBackground(field[tmpi[1]][tmpj[1]].getColor());
+ showColor = false;
+ lockClick = false;
+ //nmove++;
+ //System.out.println("Color 0: "+field[tmpi[0]][tmpj[0]].getColorHide().toString()+" Color 1:"+field[tmpi[1]][tmpj[1]].getColorHide().toString());
+ // zapobiega zanikaniu pojedynczego kafla
+ if (tmpi[0] != tmpi[1] || tmpj[0] != tmpj[1]) {
+ //label.setText(" Odnaleziono !");
+ // jesli te same kolory
+ if (field[tmpi[0]][tmpj[0]].getColorHide().toString().equals(field[tmpi[1]][tmpj[1]].getColorHide().toString())) {
+
+ //field[tmpi[0]][tmpj[0]].setFound(true);
+ //field[tmpi[1]][tmpj[1]].setFound(true);
+ field[tmpi[0]][tmpj[0]].button.setText(" ");
+ field[tmpi[1]][tmpj[1]].button.setText(" ");
+ //Toolkit.getDefaultToolkit().beep();
+
+ label.setText("");
+ nFields -= 2;
+ System.out.println("nFields: " + nFields);
+ } else label.setText("");
+ }
+
+
+ }
+ }
+ else {
+ JOptionPane.showMessageDialog(frame,
+ "Wykonales "+nmove+" posuniec",
+ "Podsumowanie",
+ JOptionPane.PLAIN_MESSAGE);
+ nFields=1; // aby nie wyswietlalo drugi raz
+
+ }
+
+
+ }
+
+ }
+}
+//}
diff --git a/src/Field.java b/src/Field.java
new file mode 100644
index 0000000..578fe34
--- /dev/null
+++ b/src/Field.java
@@ -0,0 +1,41 @@
+import javax.swing.*;
+import java.awt.*;
+
+
+public class Field {
+ JButton button;
+ private Color colorHide, color;
+ private int x,y;
+ boolean found;
+ //boolean reserve;
+ boolean postReserve;
+ //Color []cArray = {BLUE,CYAN,GRAY,GREEN,MAGENTA,ORANGE,PINK,RED,WHITE,YELLOW};
+ public Field () {
+ postReserve=false;
+ }
+ public Field(int i, int j){
+ button = new JButton("?");
+ color=new Color(255,255,255);
+ y = i;
+ x = j;
+ found=false;
+ // reserve=false;
+ postReserve=false;
+
+ }
+ public Color getColorHide(){
+ return colorHide;
+ }
+ public Color getColor() {
+ return color;
+ }
+ public void setColorHide(int r, int g, int b){
+ colorHide=new Color(r,g,b);
+ }
+ public void setFound(boolean f){
+ found=f;
+ }
+ public boolean getFound(){
+ return found;
+ }
+}
diff --git a/wrapper-icon/Icon.rc b/wrapper-icon/Icon.rc
new file mode 100644
index 0000000..7e45ea3
--- /dev/null
+++ b/wrapper-icon/Icon.rc
@@ -0,0 +1 @@
+id ICON "icon/colorsmemory.ico"
diff --git a/wrapper-icon/Makefile.old.win b/wrapper-icon/Makefile.old.win
new file mode 100644
index 0000000..107331f
--- /dev/null
+++ b/wrapper-icon/Makefile.old.win
@@ -0,0 +1,33 @@
+CPP = g++.exe
+CC = gcc.exe
+
+WINDRES = windres.exe
+RES =
+OBJ = wrapper.o $(RES)
+LINKOBJ = wrapper.o $(RES)
+#LIBS = -L"/lib" -lsdl -lsdl_ttf -mwindows
+LIBS = -static-libgcc
+INCS =
+CXXINCS =
+BIN = wrapper.exe
+CXXFLAGS = $(CXXINCS) -g
+CFLAGS = $(INCS)
+RM = rm
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before wrapper.exe all-after
+
+
+clean: clean-custom
+ ${RM} $(OBJ)
+ ${RM} $(BIN)
+
+
+$(BIN): $(OBJ)
+ $(CC) $(LINKOBJ) -o "wrapper.exe" $(LIBS)
+
+wrapper.o: wrapper.c
+ $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT
+
+
diff --git a/wrapper-icon/Makefile.win b/wrapper-icon/Makefile.win
new file mode 100644
index 0000000..05bdd53
--- /dev/null
+++ b/wrapper-icon/Makefile.win
@@ -0,0 +1,36 @@
+CPP = g++.exe
+CC = i686-w64-mingw32-g++
+
+WINDRES = i686-w64-mingw32-windres
+RES =
+OBJ = wrapper.o $(RES)
+LINKOBJ = wrapper.o $(RES)
+#LIBS = -L"/lib" -lsdl -lsdl_ttf -mwindows
+LIBS = -static-libgcc
+INCS =
+CXXINCS =
+BIN = wrapper.exe
+CXXFLAGS = $(CXXINCS) -g
+CFLAGS = $(INCS)
+RM = rm
+
+.PHONY: all all-before all-after clean clean-custom
+
+all: all-before wrapper.exe all-after
+
+
+clean: clean-custom
+ ${RM} $(OBJ)
+ ${RM} $(BIN)
+
+ $(WINDRES) Icon.rc Icon.res
+
+
+$(BIN): $(OBJ)
+ $(WINDRES) Icon.rc -O coff -o icon.o
+ $(CC) $(LINKOBJ) -o "wrapper.exe" $(LIBS) icon.o
+
+wrapper.o: wrapper.c
+ $(CC) -c wrapper.c -o wrapper.o $(CFLAGS) -DNO_STDIO_REDIRECT
+
+
diff --git a/wrapper-icon/config.txt b/wrapper-icon/config.txt
new file mode 100644
index 0000000..3618f18
--- /dev/null
+++ b/wrapper-icon/config.txt
@@ -0,0 +1 @@
+.\jre\bin\javaw.exe -jar ColorsMemory.jar
diff --git a/wrapper-icon/icon/Jttt.ico b/wrapper-icon/icon/Jttt.ico
new file mode 100644
index 0000000..c5e9ee6
--- /dev/null
+++ b/wrapper-icon/icon/Jttt.ico
Binary files differ
diff --git a/wrapper-icon/icon/Trefle.ico b/wrapper-icon/icon/Trefle.ico
new file mode 100644
index 0000000..c753797
--- /dev/null
+++ b/wrapper-icon/icon/Trefle.ico
Binary files differ
diff --git a/wrapper-icon/icon/colorsmemory.ico b/wrapper-icon/icon/colorsmemory.ico
new file mode 100644
index 0000000..eb2475a
--- /dev/null
+++ b/wrapper-icon/icon/colorsmemory.ico
Binary files differ
diff --git a/wrapper-icon/icon/ufo-small.ico b/wrapper-icon/icon/ufo-small.ico
new file mode 100644
index 0000000..44ed689
--- /dev/null
+++ b/wrapper-icon/icon/ufo-small.ico
Binary files differ
diff --git a/wrapper-icon/wrapper.c b/wrapper-icon/wrapper.c
new file mode 100644
index 0000000..5ea19f8
--- /dev/null
+++ b/wrapper-icon/wrapper.c
@@ -0,0 +1,71 @@
+#include <stdio.h> // printf
+#include <stdlib.h> // exit
+#include <string.h>
+#include <unistd.h> // sleep access
+
+/*
+char * current(char * name){
+ char *file;
+
+ if (!getenv("CD")) {
+ printf ("Zmienna srodowiskowa \"CD\" nie istnieje !\n");
+ exit (1);
+ }
+ file=malloc(strlen(getenv("CD")+strlen(name)+1));
+ strcpy(file, getenv("CD"));
+ strcat(file, name);
+
+ return file;
+}
+*/
+
+char * file_exist(){
+ char * name = (char *)".\\config.txt";
+ //char *file = current(name);
+ char *file = name;
+
+ if (access(file, F_OK)==0){
+ printf("PLIK istnieje %s\n",file);
+ free(file);
+ return file;
+ }
+ printf("PLIK nie istnieje %s\n",file);
+ free(file);
+ return NULL;
+}
+
+
+
+void load(){
+
+ char * file = file_exist();
+ char bufor1[128];
+ char bufor2[128];
+ char bufor3[128];
+ char run[384];
+
+ if (!file) exit(1);
+
+ FILE * f = fopen(file, "r");
+ fscanf(f, "%s %s %s", bufor1,bufor2,bufor3);
+ fclose(f);
+ strcpy(run, bufor1);
+ strcat(run, " ");
+ strcat(run, bufor2);
+ strcat(run, " ");
+ strcat(run, bufor3);
+ printf("Uruchamiam %s \n",run);
+ free(file);
+
+ system(run);
+
+
+
+
+}
+
+int main (){
+ load();
+
+ return 0;
+}