--- /dev/null
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
--- /dev/null
+2004-05-13 Mikko Rauhala <mjr@iki.fi>
+
+ * Original release.
\ No newline at end of file
--- /dev/null
+ Ghextris 0.9.0 copyright Mikko Rauhala <mjr@iki.fi>, 2004
+ ---------------------------------------------------------
+
+If you're running a Debian GNU/Linux (or possibly GNU/Hurd) system, you
+can create a Debian package of Ghextris easily by running, as root or
+under fakeroot, "debian/rules binary". The debian package can then be
+installed as usual.
+
+If you're not running Debian, Ghextris can be installed by running the
+install.sh and providing it with a directory to install under. Examples:
+
+# Install under /usr/local
+./install.sh /usr/local
+
+# Install under $HOME
+./install.sh $HOME
+
+The script can also take a second parameter which allows you to spesify
+the final resting place of the directory structures from where the
+program is to be run, if you're not installing it directly where it will
+reside. Examples:
+
+# Install to tmpinstall, but make sure the programs runs from /usr/local
+# when moved there
+./install.sh tmpinstall /usr/local
+
+The installation process requires msgfmt from the gettext package to
+install message catalogs for alternative languages. If msgfmt is not
+present, the installation will simply not install the translations, but
+only the base program.
--- /dev/null
+ Ghextris 0.9.0 copyright Mikko Rauhala <mjr@iki.fi>, 2004
+ ---------------------------------------------------------
+
+Ghextris is a Python/Gnome reimplementation of the semi-free Xhextris by
+David Markley. The object of the game is basically the same as in Tetris;
+use the pieces that fall down from the top of the game area to construct
+fully filled lines, which will then disappear to make room for more pieces.
+The twist, as first introduced by Markley, is that the pieces are composed
+of hexagonal blocks, so your visualization skills will get an extra workout.
+
+The pieces can be moved left and right with the respective arrow keys
+and rotated with the up and down arrow keys. If you're satisfied with
+where a piece is going, it can be dropped by pressing the space bar.
+The game will end when the pile of pieces reaches the top of the game area.
+
+This version is fully playable and should have no significant bugs.
+High scores are not saved in this release, as properly done this would
+require a setgid games wrapper program. This will be added (as an
+option) by version 1.0; patches and wrappers are welcome if you'd like
+to make it sooner.
+
+Along with the usual bug reports, feedback would be appreciated also
+on the scoring system, piece colors (with suggestions) and the
+difficulty. Not saving the high scores yet allows me to tune them a bit
+still with a clear conscience ;)
+
+Currently you get 1 point for every line that you drop a piece, and
+100, 200, 400 or 800 points for 1, 2, 3 or 4 simultaneously destroyed
+lines, respectively. Pieces drop initially one line per 0.4 seconds,
+and the interval is multiplied by 0.99 per each destroyed line.
+
+Ghextris requires python 2.3 (might work with 2.2), python-gtk2,
+python-gnome2, python-glade2 and obviously Gnome 2.x.
+
+
+And finally, the legal blurp:
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--- /dev/null
+ghextris (0.9.0-1) unstable; urgency=low
+
+ * New upstream version, new Debian packaging.
+
+ -- Mikko Rauhala <mjr@iki.fi> Thu, 13 May 2004 04:37:00 +0300
--- /dev/null
+Source: ghextris
+Maintainer: Mikko Rauhala <mjr@iki.fi>
+Section: gnome
+Priority: optional
+Standards-Version: 3.6.1
+Build-Depends-Indep: gettext, debhelper
+
+Package: ghextris
+Architecture: all
+Depends: python2.3, python2.3-glade2 (>= 2.2.0-1), python2.3-gnome2 (>= 2.0.2-1), python2.3-gtk2 (>= 2.2.0-1)
+Description: A Tetris-like game on a hexagonal grid
+ Ghextris is a somewhat Tetris-like game, except that the pieces are composed
+ of hexagonal blocks instead of squares.
+ .
+ URL: http://mjr.iki.fi/software/ghextris
--- /dev/null
+This is Ghextris, packaged for Debian by Mikko Rauhala <mjr@iki.fi>.
+Original author is also Mikko Rauhala.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
--- /dev/null
+?package(ghextris):needs="X11" section="Games/Tetris-like" \
+ title="Ghextris" command="/usr/games/ghextris" \
+ icon="/usr/share/games/ghextris/ghextris-icon.xpm"
--- /dev/null
+#!/usr/bin/make -f
+
+package=ghextris
+
+build:
+
+binary-arch:
+
+binary: binary-indep
+
+binary-indep:
+ rm -rf debian/tmp
+ rm -f debian/*.debhelper
+ install -d debian/tmp debian/tmp/DEBIAN
+ install -d debian/tmp/usr/games
+ install -d debian/tmp/usr/share/doc/$(package)
+
+ /bin/sh install.sh debian/tmp/usr /usr
+
+ cp ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
+ cp debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
+ cp README debian/tmp/usr/share/doc/$(package)/
+ gzip -9 debian/tmp/usr/share/doc/$(package)/*
+ gzip -9 debian/tmp/usr/share/man/man6/ghextris.6
+ cp debian/copyright debian/tmp/usr/share/doc/$(package)
+ dh_installmenu
+ dh_installdeb
+ dpkg-gencontrol -isp
+ chown -R root.root debian/tmp
+ chmod -R a+r debian/tmp
+ dpkg --build debian/tmp ..
+
+clean:
+ rm -rf debian/tmp debian/files debian/*.debhelper
--- /dev/null
+/* XPM */
+static char * ghextris_icon_xpm[] = {
+"32 29 117 2",
+" c None",
+". c #000000",
+"+ c #252525",
+"@ c #2F2F2F",
+"# c #242424",
+"$ c #6E6E6E",
+"% c #737373",
+"& c #565656",
+"* c #1D1D1D",
+"= c #717171",
+"- c #0A0A0A",
+"; c #6F6F6F",
+"> c #171717",
+", c #585858",
+"' c #636363",
+") c #4E4E4E",
+"! c #0B0B0B",
+"~ c #414141",
+"{ c #383838",
+"] c #292929",
+"^ c #666666",
+"/ c #1A1A1A",
+"( c #0D0D0D",
+"_ c #111111",
+": c #0C0C0C",
+"< c #2D2D2D",
+"[ c #212121",
+"} c #272727",
+"| c #191919",
+"1 c #050505",
+"2 c #6B6B6B",
+"3 c #5E5E5E",
+"4 c #2B2B2B",
+"5 c #676767",
+"6 c #161616",
+"7 c #333333",
+"8 c #595959",
+"9 c #3E3E3E",
+"0 c #040404",
+"a c #4B4B4B",
+"b c #373737",
+"c c #656565",
+"d c #110B00",
+"e c #946000",
+"f c #C17D00",
+"g c #AA6E00",
+"h c #150E00",
+"i c #4D4D4D",
+"j c #575757",
+"k c #434343",
+"l c #232323",
+"m c #4F3300",
+"n c #FFA500",
+"o c #714900",
+"p c #282828",
+"q c #535353",
+"r c #E09100",
+"s c #FCA300",
+"t c #0C0800",
+"u c #727272",
+"v c #707070",
+"w c #626262",
+"x c #131313",
+"y c #492F00",
+"z c #F39E00",
+"A c #634000",
+"B c #1B1B1B",
+"C c #070707",
+"D c #070400",
+"E c #7A4F00",
+"F c #A76C00",
+"G c #905D00",
+"H c #090600",
+"I c #503400",
+"J c #D08700",
+"K c #EE9A00",
+"L c #0B0700",
+"M c #180F00",
+"N c #261800",
+"O c #221600",
+"P c #1B1100",
+"Q c #1D1300",
+"R c #231700",
+"S c #D18700",
+"T c #F69F00",
+"U c #432C00",
+"V c #E39300",
+"W c #3A2500",
+"X c #322000",
+"Y c #6C4600",
+"Z c #AC6F00",
+"` c #613F00",
+" . c #7D5100",
+".. c #915E00",
+"+. c #120B00",
+"@. c #D78B00",
+"#. c #462D00",
+"$. c #AE7000",
+"%. c #DB8D00",
+"&. c #C47F00",
+"*. c #322100",
+"=. c #F7A000",
+"-. c #170F00",
+";. c #2F1E00",
+">. c #E59400",
+",. c #603E00",
+"'. c #402900",
+"). c #FAA200",
+"!. c #986300",
+"~. c #D28800",
+"{. c #191000",
+"]. c #BE7B00",
+"^. c #362300",
+"/. c #F59E00",
+"(. c #422A00",
+"_. c #684300",
+":. c #513400",
+" . + @ @ + . ",
+" # $ % % $ # ",
+" . & % % % % & . ",
+" * = % % % % = * . . . . ",
+" - ; % % % % ; > , ' ' ) ! ",
+" . ~ % % % % ~ { % % % % ] . ",
+" > ^ % % ^ / % % % % % ^ . ",
+" . ( _ _ : < % % % % % $ [ # } } | . ",
+" 1 2 % % % % 3 4 = % % 5 6 ",
+" . 7 % % % % ] 8 % % % % 9 . ",
+" . . . . 0 ~ a a b } % % % % % c _ ",
+" d e f f g h - i j j k l % % % % % ' ( ",
+" . m n n n n o . . 7 % % % % p q % % % % b . ",
+" . r n n n n s t 1 u % % % % c + v % % w x ",
+" y z n n n n n A < % % % % % $ [ B * * x . ",
+" . r n n n n s t 1 u % % % % c . ",
+" . m n n n n o . . 7 % % % % # . ",
+" d e f f g h - i j j k C ",
+" D E F F G H . . . . ",
+" I n n n n o . ",
+" . J n n n n K L ",
+" M N N O y z n n n n n A P N N Q . ",
+" R S n n T U V n n n n n W V n n V X ",
+". Y n n n n Z ` n n n n ...n n n n G . ",
+"+.@.n n n n n #.$.%.%.&.*.=.n n n n =.-. ",
+";.>.n n n n n ,.. . . . '.).n n n n ).'. ",
+". !.n n n n ~.{. . ].n n n n ].. ",
+" ^.K n n s Y m /.n n /.m ",
+" . (._._.,.. . :._._.:.. "};
--- /dev/null
+[Desktop Entry]
+Encoding=UTF-8
+Name=Ghextris
+Name[fi]=Ghextris
+Comment=Fit falling blocks together on a hexagonal grid
+Comment[fi]=Sovita putoavat palikat yhteen heksaruudukolla
+Icon=/usr/share/games/ghextris/ghextris.png
+Exec=ghextris
+Terminal=false
+Type=Application
+Categories=GNOME;Application;Game;BlocksGame;
+StartupNotify=true
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+<requires lib="canvas"/>
+<requires lib="bonobo"/>
+
+<widget class="GnomeApp" id="GhextrisApp">
+ <property name="title" translatable="yes">Ghextris</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="icon">ghextris.png</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="enable_layout_config">True</property>
+
+ <child internal-child="dock">
+ <widget class="BonoboDock" id="bonobodock1">
+ <property name="visible">True</property>
+ <property name="allow_floating">True</property>
+
+ <child>
+ <widget class="BonoboDockItem" id="bonobodockitem1">
+ <property name="visible">True</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkMenuBar" id="menubar">
+ <property name="visible">True</property>
+
+ <child>
+ <widget class="GtkMenuItem" id="game">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_GAME_TREE</property>
+
+ <child>
+ <widget class="GtkMenu" id="game_menu">
+
+ <child>
+ <widget class="GtkMenuItem" id="new">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_NEW_GAME_ITEM</property>
+ <signal name="activate" handler="on_new_activate" last_modification_time="Sat, 08 May 2004 19:05:06 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkImageMenuItem" id="pause_game">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_PAUSE_GAME_ITEM</property>
+ <signal name="activate" handler="on_pause_game_activate" last_modification_time="Sat, 08 May 2004 19:05:06 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separator">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkImageMenuItem" id="quit">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property>
+ <signal name="activate" handler="on_quit_activate" last_modification_time="Sat, 08 May 2004 19:05:06 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="help">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property>
+
+ <child>
+ <widget class="GtkMenu" id="help_menu">
+
+ <child>
+ <widget class="GtkImageMenuItem" id="about">
+ <property name="visible">True</property>
+ <property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property>
+ <signal name="activate" handler="on_about_activate" last_modification_time="Sat, 08 May 2004 19:05:06 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="placement">BONOBO_DOCK_TOP</property>
+ <property name="band">0</property>
+ <property name="position">0</property>
+ <property name="offset">0</property>
+ <property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GnomeCanvas" id="canvas">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="anti_aliased">False</property>
+ <property name="scroll_x1">0</property>
+ <property name="scroll_y1">0</property>
+ <property name="scroll_x2">100</property>
+ <property name="scroll_y2">100</property>
+ <property name="pixels_per_unit">1</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GnomeCanvas" id="previewcanvas">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="anti_aliased">False</property>
+ <property name="scroll_x1">0</property>
+ <property name="scroll_y1">0</property>
+ <property name="scroll_x2">100</property>
+ <property name="scroll_y2">100</property>
+ <property name="pixels_per_unit">1</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child internal-child="appbar">
+ <widget class="GnomeAppBar" id="appbar">
+ <property name="visible">True</property>
+ <property name="has_progress">False</property>
+ <property name="has_status">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+</widget>
+
+<widget class="GnomeAbout" id="about">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="icon">ghextris.png</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_CENTER</property>
+ <property name="logo">ghextris.png</property>
+ <property name="copyright" translatable="yes">© 2004 Mikko Rauhala <mjr@iki.fi></property>
+ <property name="comments" translatable="yes"></property>
+ <property name="authors">Mikko Rauhala <mjr@iki.fi></property>
+ <property name="translator_credits" translatable="yes">translator_credits</property>
+</widget>
+
+<widget class="GtkWindow" id="window1">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">window1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkButton" id="button3">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
+
+<glade-project>
+ <name>Ghextris</name>
+ <program_name>ghextris</program_name>
+ <output_main_file>FALSE</output_main_file>
+ <output_support_files>FALSE</output_support_files>
+ <output_build_files>FALSE</output_build_files>
+</glade-project>
--- /dev/null
+.TH ghextris 6 "May 20, 2004" "X Version 11"
+.SH NAME
+ghextris \- Hextris game for GNOME
+.SH SYNOPSIS
+.B ghextris
+.SH DESCRIPTION
+.IR ghextris
+is a Python/GNOME reimplementation of the semi-free Xhextris by
+David Markley. The object of the game is basically the same as in Tetris;
+use the pieces that fall down from the top of the game area to construct
+fully filled lines, which will then disappear to make room for more pieces.
+The twist, as first introduced by Markley, is that the pieces are composed
+of hexagonal blocks, so your visualization skills will get an extra workout.
+
+.SH RULES
+The pieces can be moved left and right with the respective arrow keys
+and rotated with the up and down arrow keys. If you're satisfied with
+where a piece is going, it can be dropped by pressing the space bar.
+Fully formed lines will disappear from the playing field.
+The game will end when the pile of pieces reaches the top of the game area.
+
+.SS Score
+You get 1 point for every line that you drop a piece, and
+100, 200, 400 or 800 points for 1, 2, 3 or 4 simultaneously destroyed
+lines, respectively.
+
+.SH AUTHOR
+Mikko Rauhala <mjr@iki.fi>
+
+.SH COPYRIGHT
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+.PP
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
--- /dev/null
+#!/usr/bin/python2.3
+
+# Gnome-hextris; a free rewrite of the xhextris game in Python for Gnome
+# Copyright 2004 Mikko Rauhala <mjr@iki.fi>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# This will be overwritten for the installed version:
+SHAREDIR = "."
+
+VERSION="0.9.0"
+
+import os
+import sys
+
+import pygtk
+pygtk.require("2.0")
+
+import gtk
+import gnome.canvas
+import gnome
+import gobject
+import gtk.glade
+
+import gettext
+
+import whrandom
+
+class Hextris:
+ def __init__(self):
+ self.pieceheight = 24
+ self.piecewidth = 26
+ self.piecenarrow = 14
+# self.piecewidth = 20
+# self.piecenarrow = 20
+ self.rows = 23
+ self.cols = 13 # Must be odd or weirdness ensues
+
+ self.width = (((self.cols/2)+2)*self.piecewidth +
+ ((self.cols/2)+1) * self.piecenarrow) + 2
+ self.height = (self.rows+1) * self.pieceheight + 2
+
+ self.colors = ("blue", "yellow", "red", "orange", "green", "purple",
+ "cyan", "gray45", "magenta", "lightblue")
+ self.deltax = (-1, -1, -1, 0, 0, 0, 0, 0, -1, -1)
+ self.deltay = (-1, -1, -1, 0, 0, 0, 0, 0, -1, -1)
+ self.pieces = (
+ (((0,), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0,), (0, 0, 0, 1), (0, 1, 1), (1,)),
+ ((0,), (1, 1), (0, 0, 1, 1)),
+ ((0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0,), (0, 0, 0, 1, 1), (0, 1, 1)),
+ ((0,), (0, 1), (0, 0, 1, 1), (0, 0, 0, 0, 1))),
+ (((0,), (0, 0, 1), (0, 0, 1, 1), (0, 0, 0, 1)),
+ ((0,), (0, 0, 0, 1), (0, 0, 1), (0, 1, 1)),
+ ((0,), (0,), (1, 1, 1, 1)),
+ ((0, 1), (0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0, 0, 0, 1), (0, 0, 1), (0, 1, 1)),
+ ((0,), (0, 1, 0, 1), (0, 0, 1, 0, 1))),
+ (((0,), (0, 0, 1), (0, 1, 1), (0, 1)),
+ ((0,), (0, 1, 0, 1), (1, 0, 1, 0)),
+ ((0, 1), (0, 0, 1), (0, 0, 1, 1)),
+ ((0, 0, 0, 1), (0, 0, 0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0,), (0,), (0, 1, 1, 1, 1)),
+ ((0,), (0, 1), (0, 0, 1), (0, 0, 1, 1))),
+ (((0, 1, 0), (0, 1, 0), (1, 0, 1)),
+ ((0,), (1, 1, 1), (0, 1, 0))),
+ (((0, 1), (1,), (1, 1)),
+ ((0, 1), (1, 0, 1), (1,)),
+ ((0, 1), (1, 0, 1), (0, 0, 1)),
+ ((0, 1), (0, 0, 1), (0, 1, 1)),
+ ((0,), (0, 0, 1), (1, 1, 1)),
+ ((0,), (1,), (1, 1, 1))),
+ (((0,), (0, 1), (1, 1, 1)),
+ ((0,), (1, 1), (1, 1, 0)),
+ ((0, 1), (1, 1), (1,)),
+ ((0, 1), (1, 1, 1)),
+ ((0, 1), (0, 1, 1), (0, 0, 1)),
+ ((0,), (0, 1, 1), (0, 1, 1))),
+ (((0, 1), (0, 1), (0, 1, 1)),
+ ((0,), (0, 1, 1), (1, 1)),
+ ((0,), (1, 1), (1, 0, 1)),
+ ((0, 1), (1, 1), (0, 1)),
+ ((0, 1), (0, 1, 1), (1,)),
+ ((0,), (1, 1, 1), (0, 0, 1))),
+ (((0, 1), (0, 1), (1, 1)),
+ ((0,), (1, 1, 1), (1,)),
+ ((0, 1), (1, 1), (0, 0, 1)),
+ ((0, 1), (0, 1, 1), (0, 1)),
+ ((0,), (0, 1, 1), (1, 0, 1)),
+ ((0,), (1, 1), (0, 1, 1))),
+ (((0,), (0, 0, 1), (0, 0, 1), (0, 0, 1, 1)),
+ ((0,), (0, 0, 0, 1), (0, 1, 1), (0, 1)),
+ ((0,), (0, 1), (1, 0, 1, 1)),
+ ((0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0, 0, 0, 1), (0, 0, 0, 1), (0, 1, 1)),
+ ((0,), (0, 1), (0, 0, 1, 1, 1))),
+ (((0,), (0, 0, 1), (0, 0, 1), (0, 1, 1)),
+ ((0,), (0, 0, 0, 1), (1, 1, 1)),
+ ((0, 1), (0, 1), (0, 0, 1, 1)),
+ ((0, 0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1)),
+ ((0,), (0, 0, 0, 1), (0, 1, 1, 0, 1)),
+ ((0,), (0, 1), (0, 0, 1, 1), (0, 0, 0, 1)))
+ )
+
+ self.attitude = 0
+ self.speed_orig = 400
+ self.speed = 400
+ self.speed_ratio = 0.99
+ self.speed_reset = gtk.FALSE
+ self.paused = gtk.FALSE
+ self.lost = gtk.TRUE
+ self.score = 0
+ self.hiscore = 0
+ self.nextnum = 0
+
+ self.running = gtk.FALSE
+
+ self.nextpiece = gtk.FALSE
+ self.board = gtk.FALSE
+ self.rowgroups = []
+
+ def draw_hexagon(self, group, color):
+ pts = []
+ pts.append ((self.piecewidth - self.piecenarrow)/2)
+ pts.append (0)
+ pts.append (self.piecewidth - pts[0])
+ pts.append (0)
+ pts.append (self.piecewidth)
+ pts.append (self.pieceheight/2)
+ pts.append (pts[2])
+ pts.append (self.pieceheight)
+ pts.append (pts[0])
+ pts.append (pts[7])
+ pts.append (0)
+ pts.append (pts[5])
+ pts.append (pts[0])
+ pts.append (pts[1])
+ item = group.add ("GnomeCanvasPolygon", points = pts, fill_color = color,
+ outline_color = "black", width_units = 1)
+ return item
+
+ def draw_piece(self, group, matrix, color):
+ for i in range(len(matrix)):
+ for j in range(len(matrix[i])):
+ if matrix[i][j] != 0:
+ g = group.add("GnomeCanvasGroup",
+ x = (j*(self.piecewidth+self.piecenarrow)/2),
+ y = ((i * (self.pieceheight)) +
+ ((j%2) * self.pieceheight/2)))
+ self.draw_hexagon(g, color)
+
+ def place_piece(self, group, matrix, color, x, y):
+ piecegroup = group.add("GnomeCanvasGroup",
+ x = (x+1)*((self.piecewidth+self.piecenarrow)/2),
+ y = ((y * self.pieceheight) -
+ (((x%2)+1) * self.pieceheight/2)))
+ self.draw_piece(piecegroup, matrix, color)
+ return piecegroup
+
+ def init_board(self):
+ board = self.canvas.root()
+ for i in range(self.rows+1):
+ for j in [0, 1]:
+ boardhex = board.add("GnomeCanvasGroup",
+ x = j * (self.piecewidth*(self.cols/2+1) +
+ self.piecenarrow*(self.cols/2+1)),
+ y = i * self.pieceheight)
+ self.draw_hexagon(boardhex, "gray")
+ for i in range(self.cols/2):
+ boardhex = board.add("GnomeCanvasGroup",
+ x = (i+1) * (self.piecewidth +
+ self.piecenarrow),
+ y = self.rows * self.pieceheight)
+ self.draw_hexagon(boardhex, "gray")
+ for i in range(self.cols/2+1):
+ boardhex = board.add("GnomeCanvasGroup",
+ x = (i * (self.piecewidth + self.piecenarrow)+
+ (self.piecewidth + self.piecenarrow)/2),
+ y = ((self.rows*2-1) * self.pieceheight)/2)
+ self.draw_hexagon(boardhex, "gray")
+
+ def on_new_activate(self, event):
+ self.speed = self.speed_orig
+ self.score = 0
+ self.attitude = 0
+ self.lost = gtk.FALSE
+ self.paused = gtk.FALSE
+
+ self.update_appbar()
+
+ if self.board != gtk.FALSE:
+ self.board.destroy()
+ self.board = self.canvas.root().add("GnomeCanvasGroup", x = 0, y = 0)
+
+ self.field = []
+ for i in range(self.rows):
+ self.field.append([])
+ for j in range(self.cols):
+ self.field[i].append(0)
+
+ self.rowgroups = []
+ for i in range(self.rows):
+ self.rowgroups.append(self.board.add("GnomeCanvasGroup", x = 0,
+ y = i * self.pieceheight))
+
+ self.nextnum = whrandom.randint(0, 9)
+ self.next_piece()
+
+ if self.running == gtk.FALSE:
+ gobject.timeout_add(self.speed, self.timer_handler)
+ self.running = gtk.TRUE
+ else:
+ self.speed_reset = gtk.TRUE
+
+ return gtk.TRUE
+
+ def on_about_activate(self, event):
+ aTree = gtk.glade.XML(self.glade, "about")
+ about = aTree.get_widget("about")
+ about.set_property("name", "Ghextris")
+ about.set_property("version", VERSION)
+ return gtk.TRUE
+
+ def on_pause_game_activate(self, event):
+ if self.lost == gtk.TRUE:
+ return gtk.FALSE
+ if self.paused == gtk.TRUE:
+ self.paused = gtk.FALSE
+ else:
+ self.paused = gtk.TRUE
+ return gtk.TRUE
+
+ def on_quit_activate(self, event):
+ gtk.main_quit()
+
+ def main(self):
+ gnome.init("Ghextris", VERSION)
+ gettext.install("ghextris")
+ self.glade = os.path.join(SHAREDIR, "ghextris.glade")
+
+ wTree = gtk.glade.XML(self.glade, "GhextrisApp")
+ dic = {"on_new_activate": self.on_new_activate,
+ "on_pause_game_activate": self.on_pause_game_activate,
+ "on_quit_activate": self.on_quit_activate,
+ "on_about_activate": self.on_about_activate}
+ wTree.signal_autoconnect(dic)
+
+ win = wTree.get_widget("GhextrisApp")
+ self.canvas = wTree.get_widget("canvas")
+ preview = wTree.get_widget("previewcanvas")
+ appbar = wTree.get_widget("appbar").get_children()[0]
+ self.appbar = appbar.get_children()[0]
+
+ win.connect('destroy', self.on_quit_activate)
+
+ self.canvas.set_size_request(self.width, self.height)
+ self.canvas.set_scroll_region(0, 0, self.width, self.height)
+ self.canvas.show()
+
+ preview.set_size_request(self.piecewidth * 4, self.pieceheight * 5)
+ preview.show()
+ self.preview = preview.root()
+
+ win.connect("key-press-event", self.key_handler)
+ self.init_board()
+
+ whrandom.seed()
+
+ self.update_appbar()
+
+ win.show()
+
+ def next_piece(self):
+ self.piecenum = self.nextnum
+ self.nextnum = whrandom.randint(0, 9)
+ self.attitude = 0
+ self.piece_x = (self.cols/2)-1 + self.deltax[self.piecenum]
+ self.piece_y = -3 + self.deltax[self.piecenum]
+ self.piece = self.place_piece(self.board, self.pieces[self.piecenum][0],
+ self.colors[self.piecenum%(len(self.colors)+1)],
+ self.piece_x, self.piece_y)
+
+ if self.nextpiece != gtk.FALSE:
+ self.nextpiece.destroy()
+ self.nextpiece = self.place_piece(self.preview,
+ self.pieces[self.nextnum][0],
+ self.colors[self.nextnum%(len(self.colors)+1)],
+ self.deltax[self.nextnum],
+ self.deltay[self.nextnum])
+
+ def timer_handler(self):
+ if self.lost == gtk.TRUE:
+ self.running = gtk.FALSE
+ return gtk.FALSE
+
+ if self.paused == gtk.TRUE:
+ return gtk.TRUE
+ self.piece_y += 1
+
+ if self.check_collisions() == gtk.TRUE:
+ self.piece_y -= 1
+ self.update_field()
+ if self.top_occupied() != gtk.TRUE:
+ self.next_piece()
+ else:
+ self.lost = gtk.TRUE
+ if self.hiscore < self.score:
+ self.hiscore = self.score
+ self.update_appbar()
+ self.running = gtk.FALSE
+ return gtk.FALSE
+ else:
+ self.piece.move(0, self.pieceheight)
+
+ if self.speed_reset == gtk.TRUE:
+ self.speed_reset = gtk.FALSE
+ gobject.timeout_add(int(self.speed), self.timer_handler)
+ return gtk.FALSE
+
+ return gtk.TRUE
+
+ def update_appbar(self):
+ self.appbar.set_text("%s: %d | %s: %d" % (_("Score"), self.score,
+ _("High score"),
+ self.hiscore))
+
+ def key_handler(self, widget, event=None):
+ if self.lost == gtk.TRUE:
+ return gtk.FALSE
+
+ if event.keyval == gtk.keysyms.p and self.lost == gtk.FALSE:
+ if self.paused == gtk.TRUE:
+ self.paused = gtk.FALSE
+ else:
+ self.paused = gtk.TRUE
+ return gtk.TRUE
+
+ if self.paused == gtk.TRUE:
+ return gtk.FALSE
+
+ if event.keyval == gtk.keysyms.Up or event.keyval == gtk.keysyms.Down:
+ if event.keyval == gtk.keysyms.Up:
+ attitude_change = 1
+ else:
+ attitude_change = -1
+ old_attitude = self.attitude
+ self.attitude = ((self.attitude + attitude_change +
+ len(self.pieces[self.piecenum])) %
+ len(self.pieces[self.piecenum]))
+ if self.check_collisions() == gtk.TRUE:
+ self.attitude = old_attitude
+ return gtk.TRUE
+
+ self.piece.destroy()
+ self.piece = self.place_piece(self.board,
+ self.pieces[self.piecenum][self.attitude],
+ self.colors[self.piecenum%(len(self.colors)+1)],
+ self.piece_x, self.piece_y);
+ return gtk.TRUE
+
+ if event.keyval == gtk.keysyms.Left or event.keyval == gtk.keysyms.Right:
+ if event.keyval == gtk.keysyms.Left:
+ deltax = -1
+ else:
+ deltax = 1
+ self.piece_x += deltax
+
+ deltay = 0
+ if self.piece_x%2 == 0:
+ deltay += self.pieceheight/2
+ else:
+ deltay -= self.pieceheight/2
+
+ if self.check_collisions() == gtk.TRUE:
+ if deltay > 0:
+ self.piece_x -= deltax
+ return gtk.TRUE
+ self.piece_y += 1
+ deltay += self.pieceheight
+ if self.check_collisions() == gtk.TRUE:
+ self.piece_x -= deltax
+ self.piece_y -= 1
+ return gtk.TRUE
+
+ self.piece.move(deltax*(self.piecewidth+self.piecenarrow)/2, deltay)
+ return gtk.TRUE
+
+ if event.keyval == gtk.keysyms.space:
+ orig_piece_y = self.piece_y
+ while self.check_collisions() == gtk.FALSE:
+ self.piece_y += 1
+ self.piece_y -= 1
+ self.piece.move(0, self.pieceheight*(self.piece_y - orig_piece_y))
+ self.score += self.piece_y - orig_piece_y
+ if self.score > self.hiscore:
+ self.hiscore = self.score
+ self.update_field()
+ if self.top_occupied() != gtk.TRUE:
+ self.next_piece()
+ else:
+ self.lost = gtk.TRUE
+ if self.hiscore < self.score:
+ self.hiscore = self.score
+ self.update_appbar()
+
+ return gtk.TRUE
+
+ return gtk.FALSE
+
+ def check_collisions(self):
+ for i in range(len(self.pieces[self.piecenum][self.attitude])):
+ for j in range(len(self.pieces[self.piecenum][self.attitude][i])):
+ if self.pieces[self.piecenum][self.attitude][i][j] != 0:
+ if j%2 == 0 and self.piece_x%2 == 1:
+ deltay = -1
+ else:
+ deltay = 0
+ if j + self.piece_x < 0 or j + self.piece_x >= self.cols:
+ return gtk.TRUE
+ if ((i + self.piece_y + deltay > 0) and
+ (i + self.piece_y + deltay >= self.rows or
+ self.field[i + self.piece_y + deltay][j + self.piece_x] != 0)):
+ return gtk.TRUE
+ return gtk.FALSE
+
+ def update_field(self):
+ for i in range(len(self.pieces[self.piecenum][self.attitude])):
+ for j in range(len(self.pieces[self.piecenum][self.attitude][i])):
+ if self.pieces[self.piecenum][self.attitude][i][j] != 0:
+ if j%2 == 0 and self.piece_x%2 == 1:
+ deltay = -1
+ else:
+ deltay = 0
+ if i+self.piece_y+deltay >= 0:
+ self.field[i + self.piece_y + deltay][j + self.piece_x] = 1
+ self.place_piece(self.rowgroups[i+self.piece_y+deltay],
+ ((0, 1,),),
+ self.colors[self.piecenum%(len(self.colors)+1)],
+ j + self.piece_x - 1, 0)
+ self.piece.destroy()
+ self.collapse_rows()
+
+ def collapse_rows(self):
+ row_points = 50
+ for i in range(self.rows):
+ row_full = gtk.TRUE
+ for j in range(self.cols):
+ if self.field[i][j] == 0:
+ row_full = gtk.FALSE
+ break
+
+ if row_full == gtk.TRUE:
+ row_points *= 2
+ self.speed *= self.speed_ratio
+ self.speed_reset = gtk.TRUE
+ self.rowgroups[i].destroy()
+ for j in range(i-1, -1, -1):
+ self.rowgroups[j].move(0, self.pieceheight)
+ self.rowgroups[j+1] = self.rowgroups[j]
+ self.field[j+1] = self.field[j]
+ self.field[0] = []
+ for j in range(self.cols):
+ self.field[0].append(0)
+ self.rowgroups[0] = self.board.add("GnomeCanvasGroup", x = 0,
+ y = 0)
+ if row_points > 50:
+ self.score += row_points
+ if self.score > self.hiscore:
+ self.hiscore = self.score
+ self.update_appbar()
+
+ def top_occupied(self):
+ for i in range(self.cols):
+ if self.field[0][i] != 0:
+ return gtk.TRUE
+ return gtk.FALSE
+
+if __name__ == '__main__':
+ h = Hextris()
+ h.main()
+ gtk.main()
--- /dev/null
+#!/bin/sh
+
+if [ "f$1" == f ]; then
+ echo "usage: $0 prefix [real_prefix]"
+ echo
+ echo "where prefix is the directory under which to install (eg. /usr, /usr/local)"
+ echo "and real_prefix is the directory under which the program is eventually"
+ echo "to run (the same as prefix by default)."
+ echo "You probably don't want to touch the latter by hand."
+ echo
+ exit
+fi
+
+PREFIX="$1"
+BINDIR="$PREFIX/games"
+MANDIR="$PREFIX/share/man/man6"
+SHAREDIR="$PREFIX/share/games/ghextris"
+LOCALEDIR="$PREFIX/share/locale"
+APPDIR="$PREFIX/share/applications"
+
+if [ "f$2" == f ]; then
+ REALPREFIX="$PREFIX"
+else
+ REALPREFIX="$2"
+fi
+
+REALSHAREDIR="$REALPREFIX/share/games/ghextris"
+
+umask 022
+
+echo "Installing program files"
+
+mkdir -m 755 -p "$BINDIR" || exit 1
+mkdir -m 755 -p "$SHAREDIR" || exit 1
+mkdir -m 755 -p "$APPDIR" || exit 1
+mkdir -m 755 -p "$MANDIR" || exit 1
+
+sed "s#^SHAREDIR.*#SHAREDIR = \"$REALSHAREDIR\"#" < ghextris.py > "$SHAREDIR/ghextris.py" || exit 1
+chmod 755 "$SHAREDIR/ghextris.py"
+sed "s#^Icon=.*#Icon=$REALSHAREDIR/ghextris.png#" < ghextris.desktop > "$APPDIR/ghextris.desktop" || exit 1
+chmod 644 "$APPDIR/ghextris.desktop"
+
+cp ghextris.glade "$SHAREDIR" || exit 1
+cp ghextris.png "$SHAREDIR" || exit 1
+cp ghextris-icon.xpm "$SHAREDIR" || exit 1
+cp ghextris.man "$MANDIR/ghextris.6" || exit 1
+
+# We just link the .py into the games directory for now; in the future,
+# this step may be replaced by optional installation of a setgid games
+# wrapper program for scorekeeping
+ln -sf ../share/games/ghextris/ghextris.py "$BINDIR"/ghextris || exit 1
+
+echo "Checking for msgfmt"
+
+if which msgfmt > /dev/null; then
+ echo "msgfmt found, installing translations"
+
+ for a in po/*.po; do
+ LANG="`basename $a .po`"
+ echo "- Language $a"
+ mkdir -m 755 -p "$LOCALEDIR/$LANG/LC_MESSAGES"
+ msgfmt -o "$LOCALEDIR/$LANG/LC_MESSAGES/ghextris.mo" "$a" || exit 1
+ done
+else
+ echo "msgfmt not found; translations not installed"
+fi
+
+echo "Done."
--- /dev/null
+[encoding: UTF-8]
+ghextris.glade
+ghextris.py
--- /dev/null
+# Ghextris 0.9
+# Copyright (C) 2004 Mikko Rauhala
+# This file is distributed under the same license as the Ghextris package.
+# Mikko Rauhala <mjr@iki.fi>, 2004.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.9\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2004-05-13 01:48+0300\n"
+"PO-Revision-Date: 2004-05-13 01:48+0300\n"
+"Last-Translator: Mikko Rauhala <mjr@iki.fi>\n"
+"Language-Team: Finnish <fi@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ghextris.glade.h:1
+msgid "Ghextris"
+msgstr "Ghextris"
+
+#: ghextris.glade.h:2
+msgid "© 2004 Mikko Rauhala <mjr@iki.fi>"
+msgstr "© 2004 Mikko Rauhala <mjr@iki.fi>"
+
+#: ghextris.glade.h:3
+msgid "translator_credits"
+msgstr "Mikko Rauhala <mjr@iki.fi>"
+
+#: ghextris.py:334
+msgid "Score"
+msgstr "Pisteet"
+
+#: ghextris.py:335
+msgid "High score"
+msgstr "Paras tulos"
--- /dev/null
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2004-05-13 02:07+0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ghextris.glade.h:1
+msgid "Ghextris"
+msgstr ""
+
+#: ghextris.glade.h:2
+msgid "translator_credits"
+msgstr ""
+
+#: ghextris.glade.h:3
+msgid "© 2004 Mikko Rauhala <mjr@iki.fi>"
+msgstr ""
+
+#: ghextris.py:336
+msgid "Score"
+msgstr ""
+
+#: ghextris.py:337
+msgid "High score"
+msgstr ""