From 0e5a88408a993060d22d27bc2d025974fd380338 Mon Sep 17 00:00:00 2001 From: kske Date: Mon, 1 Jul 2019 18:26:43 +0200 Subject: [PATCH] Added Eclipse project and basic class structure + Piece icons + TextureLoader + BoardPanel as a UI for the chess board + Chess as a main class --- .classpath | 11 +++++ res/bishop_black.png | Bin 0 -> 1260 bytes res/bishop_white.png | Bin 0 -> 1944 bytes res/king_black.png | Bin 0 -> 2485 bytes res/king_white.png | Bin 0 -> 2279 bytes res/knight_black.png | Bin 0 -> 1516 bytes res/knight_white.png | Bin 0 -> 1878 bytes res/pawn_black.png | Bin 0 -> 797 bytes res/pawn_white.png | Bin 0 -> 1294 bytes res/queen_black.png | Bin 0 -> 2267 bytes res/queen_white.png | Bin 0 -> 2637 bytes res/rook_black.png | Bin 0 -> 725 bytes res/rook_white.png | Bin 0 -> 933 bytes src/dev/kske/chess/BoardPanel.java | 67 ++++++++++++++++++++++++++ src/dev/kske/chess/Chess.java | 56 +++++++++++++++++++++ src/dev/kske/chess/TextureLoader.java | 38 +++++++++++++++ 16 files changed, 172 insertions(+) create mode 100644 .classpath create mode 100644 res/bishop_black.png create mode 100644 res/bishop_white.png create mode 100644 res/king_black.png create mode 100644 res/king_white.png create mode 100644 res/knight_black.png create mode 100644 res/knight_white.png create mode 100644 res/pawn_black.png create mode 100644 res/pawn_white.png create mode 100644 res/queen_black.png create mode 100644 res/queen_white.png create mode 100644 res/rook_black.png create mode 100644 res/rook_white.png create mode 100644 src/dev/kske/chess/BoardPanel.java create mode 100644 src/dev/kske/chess/Chess.java create mode 100644 src/dev/kske/chess/TextureLoader.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..07b86b3 --- /dev/null +++ b/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/res/bishop_black.png b/res/bishop_black.png new file mode 100644 index 0000000000000000000000000000000000000000..453cb32355348ceadcc41e5c371130e7be1dc45e GIT binary patch literal 1260 zcmVf{mPz<;qC;@r{ONGTl!rFL<$VFh#<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TC(2UrA@4!Ho8VcLCUpW8qn5OY{*&;egr zIEIMcElK(h@Q;D7w~aB6fK1?TlI{)H#u#$|_|WI`aryFP^78T`3F%sCX=%2Y8qO}N zmuZqdqyO}9SQ%q}0sPwQ^>Y6Fd6q9<9!Z_Z;`js8{|Y9lq@;vRn>NKM z#9&QW4;y3N1%Br7c-X&xf2`e)sENF#R{@D@)~q2bD=QA}hu1^`X8|l;yf_Z7M^?x) zoEXk79>DJb%$_|v4z5R*+a8YPpIWTm1K7B6Bh#jZof2cJ?(S||9CzT)fp?!hdlm=R zuJreCm1bbA8#5VWJU|Bh8;0>#kEGUc1~CVI+coun>B+7s;K{Bj;K{E40}!$9&8%1e zBftZ|7R4-Z1y~(jgGy~JB^?It1A|Kpn*k1)+4rbAirmAJ27wza4GS;|T#c-y)S@*B z?5a5SoTPnGg_Ht55ESpNC@KRpJHo7t>qO<^6DGyqIf4;J7kjqRqZ!a6MJ3~)2k z<`=Nt%sxAm1jOFM7acs-0OuWi78C+3X#;S;$?k-c4-nVks{7_D+U@8S2E5JDYgm%J z%%XtbI(p5R@US}7_Jsi)g zBVe~W!Zza;^DjDW1q`eQUOB@y<62t*0|UUrAlPP1v=i`DFs#uy?;2}4FpX1EMy7 z<}NN-S-_G;2>kH1jK=FE<#zaBW`2%FC9O+MTFJnxfc>dSxxk~D`MFA-KNol?Ge1|! z^Y?%gwK+3CSIP6&2A=;qn7m3lD|tJc^XuUpt$PMH^({4_*q?aqqOSX!wg=ql>H&AU bx(@gc{sH)y$U_yZ00000NkvXXu0mjfw8>#< literal 0 HcmV?d00001 diff --git a/res/pawn_white.png b/res/pawn_white.png new file mode 100644 index 0000000000000000000000000000000000000000..e98fae2bd8dd89313781f3107fe1b156e4674907 GIT binary patch literal 1294 zcmV+p1@ZccP)U1TJHnm@pvR2k7wMpc6WEh@AvCX>%$wn zX(^>11J40G9uM(&JY&1JZ{Ol}|9j&1gHp<#-?7b=Ee2i#5(%9u4ZFnL&D*( zuJR^OW_c!?g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L@aNh4WqM*Yx5qSgH4=`uW99mjhXlZF76beyWTbsol8yib|FcOJmrK8a(9*-yO zai7nJ-|tVStE#H7R+(-7mvpo92{g| zU|`&pT4{N`UgKpS^+!fV(mml~~w6ye?7Ca+ANKHb$Tg&@z~^2UUC zxV*gl#{T{L>*Db^ot>S8!(ndSx@F=~Q&WT2>m7HmuC8WeWQ1rmN;Dcxdp&i(eS7@U zSVWjVe?G0PtpoxA4j(@JaYskT%z~7M!aZDHU;jZY7E6007K>?5Pmk`}wM(0uo3)~% z;-QVmvu4fGjT<*=dwaV^B9W|KaOlvX!HJ6Dz@kNq{<>z(n#$JJR+cYcPDRCoZRz3R zVY<4yxO(*}H*ek~5{VFrM6%Mu!^2FPG>Mv;8ft56@%#Pw{r+^iwzig~OPA8v*qBxK z_3PKuYwV*(k8T?p8Zv&e_)tBZY@jBrec&;V$D^xPuhzYL_v+cRXY-2P;o)J;>?KYZ z8XD4$jt#Yd{0?e2(Bkj4=`)(@j z@pwoi5)2Lwrr(uQ-cO}3Uc5+eZ*M#vkDmcLu|9L`Qq|#-^exrkaRRO5kPy&-^%afR zcCYYwJlwl?k9a(;Si2|#Sf3N8?l*xCfcI6^ajT;!{T{Z#IV%)-4yeZ3SRYW;*o4+U p(FQ+iJaK;kcxv$DjwjCG{{ez+xA)Q`_t5|V002ovPDHLkV1l?JR_*`* literal 0 HcmV?d00001 diff --git a/res/queen_white.png b/res/queen_white.png new file mode 100644 index 0000000000000000000000000000000000000000..a4fe68c80f79ab7b0b2ed6147383cda435407ea1 GIT binary patch literal 2637 zcmV-T3bOTyP)kPe1I;Fy5Vg8jMOf($(CZ^PhXqf6im>%v~iSe3is@tqquMxk31P zmm7qycey5nl~N9+)UDTI?pYHXKGioGn+Wo-WKo_tE zP#Lg$00G45bc)uW1iqPLjtamrQ(HykiV!}elQ6Xd7Py;%Q9uqKJ}hHnW75&lq2vFS zVeIb#M>R|j@GRiGW`u#IfOx%LdHLm+<)xQi5|78DlejYly8@7gh6d5)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}cn^Z6jT74t0-IbD$L#SjKiO1(#NF=B|_Zl}7s znwpv#JRZ+9&!zSq4u@p~nERnnh_h$UGB7Y;Wx{ z0jjF1=)}K3fE;ThZ z)7qRla~K&JacI#smff@~9MYPH{{ zg$pS!FE>1v+8hpt;c>I)qtPglNQ8lb0eX9T>FMb)q9ziF=+j*!xs4Ji*zh7f+W<`1 z?RM$x?373(a-~u=tMvExOKWSZ?&V(>WqXl?e+kHj4I5^Ks96pjI;0bRuNd14{$rZ9 zA@)N^?lR1_xZQ5O+n|&xyyzBshk&(^+~kVIVzcI1U1G7A+;PVpx|cT;YJV|*Jsby^ zoSek(_nQmJRTmK<7!0y#(IWj+MWJI9^YY*X{)1_^V9uO5R99CUt*WYu%F0UPIcwGQ zrDZG@vuxpTnDgh)69@$8>+7ShuaExze#Xbg^=Zd}77_WpAOeMkgm!~&Ci&U+ED&cF zp24OT1U?7aim|=u=ddo?x2_7H8mQ7*HOXz0Qj6x&jt=c+#Y{(YivWW_AIUE*eL$ax vglA;$ObP$L$&G)+U+;2*@bxZVIl}(~G3Pqk!(KD#00000NkvXXu0mjfsr>;1 literal 0 HcmV?d00001 diff --git a/res/rook_black.png b/res/rook_black.png new file mode 100644 index 0000000000000000000000000000000000000000..b9748e87f29861cb4ca00c7ce03df54f3f6b35a0 GIT binary patch literal 725 zcmV;`0xJE9P)qB%30rm0>sTv+%?-hTEN)&BmLZAG~72o44=V znRzoiS&9gXgtzMi^2Q0a9Vgg!oM78=f^A1zFv$|h_atS59g(DhzmWVy^2&z$9FmOF z`X?eHS_YsEK+dqMiv9xN{)YPmD*j1!LHP-#=Pt=_r>+lDv}uyOxAt2p!<@F-!+Dr; z54)meJLg?6lU@GCMDQiw_qA()sm0ER3Ui?5^6 z=%$E#QEF)NlmYAkc!B(@^E&{Sb#m73;nR?O0N`oA-}jo$rg6MYOs7+HIvt3}0Kg*= z`JodhlZ}UnJR`XuMbVSxa+yWQe+a`6BJxT^9vTJ8s)!(;jfnC_!)-ivoj~3=!M5WB z+l~`#J5I3eIKj5#1lvxQ2k{phjRxxVdWIqY5Cj2y-!B^n%J6;oweS0~EoQTsko;(z zXGUUg0SJ-LdDb11T#bh`$x@|Kc{3Oc_R3}R5qB1G9HZCky(D>CM2>Z0WHE=|u2!pq zFbuJ+^Q_-QQG_rID*!%_tc%EZ)fmR7mLvlJRihw!ToaK%wNc@grNRj|p2O8@)oZug zSo^|ZtBl8EOePb(#u`h|A%GYs%S5-^HD6>E84ic*OVtrh>QRy@7p)x@sU%VrvBJ$^ zC)jp$1V6^FLh(QG9Kbw{V zn!ERY_xs*^_wL^BS5ZpQNp!V4fSV=|>~{jeekTy@cLKqFM_aInSR(RXM3jRqiHNvp zuSDdFh}?F#&a{ZsTW#MIrIeNdV}QECVlLY&;HATL%5K^>GtW~xlgV6gI503^pL!x9 zPi+GpI<;3ykdU~)d z%Se321+TBKGdnv=yWs!tE;Q7 z`dF65;^Ly|P#p0rxLhu?wzg&>mX_Ju+tcstVU>PH^Huk{ZP{(yqMPv$kuZ=4?u5f( z#>dC$?d{d_)he}Gjm^zX4i66jegH#Cse&sfx+8pcqxyi)fJ!ElDxc4*>*DC>NR5n) z*dx0S+|`L$dxUL7q!0K2j3kpu=H})Ig^aI-EG#UrwY3HC6&O=W?d$mQEExWX{uGTy zhlYoT&wqRvp<1o7ySq!JQYiutbj1SRru1La`!S$0nT+x2oXuwKsr<@ooF;cmKMne7 zMAfTOSK5bSpX!G0$Y>~{jeey8IEo7}1Q0PO7SFflP<&@JS0Is0eCt1pv+ zp97@RX(lHp4Z4L$B*Mzd3Y;bmFDJI$U}*E70%~1dU21!K+js(?R4S=xG-@XS9(jq? z^9YNG1-t`7gM)(<3Iz%UcZtMS7#$sDV`BqgSw!wDrM_u7GBCOyx#4`YhK}5=c+0ud;;!3GChess
    + * File: BoardPanel.java
    + * Created: 01.07.2019
    + * Author: Kai S. K. Engelbart
    + *
    + * A square panel for rendering the chess board. To work correctly, + * this must be added to a parent component that allows the child to decide the + * size. + */ +public class BoardPanel extends JPanel { + + private static final long serialVersionUID = 6771148331334310216L; + + private int tileSize; + + public BoardPanel() { + // Add a component listener for adjusting the tile size on resizing + addComponentListener(new ComponentAdapter() { + + @Override + public void componentResized(ComponentEvent e) { + tileSize = getWidth() / 8; + } + }); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + g.setColor(Color.white); + for (int i = 0; i < 8; i++) + for (int j = 0; j < 8; j++) { + if (j > 0) g.setColor(g.getColor().equals(Color.white) ? Color.black : Color.white); + g.fillRect(tileSize * i, tileSize * j, tileSize, tileSize); + } + } + + @Override + public Dimension getMinimumSize() { return getPreferredSize(); } + + @Override + public Dimension getMaximumSize() { return getPreferredSize(); } + + @Override + public Dimension getPreferredSize() { + Dimension d = super.getPreferredSize(); + Container c = getParent(); + if (c != null) d = c.getSize(); + else return new Dimension(480, 480); + int w = (int) d.getWidth(); + int h = (int) d.getHeight(); + int s = Math.max(w, h); + return new Dimension(s, s); + } +} diff --git a/src/dev/kske/chess/Chess.java b/src/dev/kske/chess/Chess.java new file mode 100644 index 0000000..053c1dd --- /dev/null +++ b/src/dev/kske/chess/Chess.java @@ -0,0 +1,56 @@ +package dev.kske.chess; + +import java.awt.BorderLayout; +import java.awt.EventQueue; + +import javax.swing.JFrame; + + +/** + * Project: Chess
    + * File: Chess.java
    + * Created: 01.07.2019
    + * Author: Kai S. K. Engelbart + */ +public class Chess { + + private JFrame mframe; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + + public void run() { + try { + Chess window = new Chess(); + window.mframe.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public Chess() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + mframe = new JFrame(); + mframe.setBounds(100, 100, 740, 740); + mframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + BoardPanel boardPanel = new BoardPanel(); + boardPanel.setLayout(null); + mframe.getContentPane().add(boardPanel, BorderLayout.CENTER); + } + +} diff --git a/src/dev/kske/chess/TextureLoader.java b/src/dev/kske/chess/TextureLoader.java new file mode 100644 index 0000000..f805cc6 --- /dev/null +++ b/src/dev/kske/chess/TextureLoader.java @@ -0,0 +1,38 @@ +package dev.kske.chess; + +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +/** + * Project: Chess
    + * File: TextureLoader.java
    + * Created: 01.07.2019
    + * Author: Kai S. K. Engelbart + */ +public class TextureLoader { + + private TextureLoader() {} + + /** + * Loads an image from the resource folder and scales it to a square. + * + * @param name The name of the file without the PNG extension in the resource + * folder + * @param scale The side length of the square to which the image will be scaled + * @return The scaled image + */ + public static Image loadScaledImage(String name, int scale) { + BufferedImage in = null; + try { + in = ImageIO.read(new File("res" + File.separator + name + ".png")); + } catch (IOException e) { + e.printStackTrace(); + } + Image scaled = in.getScaledInstance(scale, scale, Image.SCALE_SMOOTH); + return scaled; + } +}