games-0.6.3/0000755000076400001440000000000010425102105012153 5ustar clemensusersgames-0.6.3/COPYING0000644000076400001440000004313107730541214013225 0ustar clemensusers 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. 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.) 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. 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. 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 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. Copyright (C) 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. , 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. games-0.6.3/TODO0000644000076400001440000000132207730541214012656 0ustar clemensusersTODO ==== Common ------ DONE common usable status line in display.cpp DONE fix drawing code, when frame is off precise timing of main loop on different hardware help screen (README browser) add game specific settings remember gamestate, when quitting game implement (hardware like) sprite engine more games (pacman, breakout, space invaders, ...) saved highscore list i18n support use pthread_cond_* for keys Tetris ------ prevent rising pieces, by fast rotation Tron ---- DONE fix pixel errors Minesweeper ----------- switch icon drawing code to make use of Bitmap class games-0.6.3/bitmap.cpp0000644000076400001440000000235407730541214014154 0ustar clemensusers#include // malloc(), free() #include // sscanf() #include "screen.h" #include "bitmap.h" Bitmap::Bitmap(int w, int h) { if (w>0 && h>0) { width = w; height = h; data = (char *)calloc(width*height, sizeof (char)); } } Bitmap::Bitmap(char *xpm[]) { int colors, pix; sscanf(xpm[0], "%d %d %d %d", &height, &width, &colors, &pix); data = (char *)calloc(width*height, sizeof (char)); if (data) { for (int y=colors+1; y=0 && x=0 && y=0 && x=0 && y Scr::width()) break; for (int row=0; row0; col--) { Scr::pixel(x+col, y+row, (pxl&1) ? fg : bg); pxl >>= 1; } } x += width(*txt++); } return (0); } } // namespace games-0.6.3/text.h0000644000076400001440000000031107730541214013320 0ustar clemensusers#ifndef _TEXT_H_ #define _TEXT_H_ namespace Txt { int height(void); int width(const char *txt); int width(char c); int print(int x, int y, const char *txt, int fg, int bg=0); } // namespace #endif games-0.6.3/minesweeper/0000755000076400001440000000000010425102105014476 5ustar clemensusersgames-0.6.3/minesweeper/Makefile0000644000076400001440000000033707730536743016171 0ustar clemensusersGAME = minesweeper OBJS = minesweeper.o CFLAGS = -g -pipe -O2 -Wall -Woverloaded-virtual all: $(OBJS) @ar -r $(GAME).a $(OBJS) clean: @echo -n "." @rm -rf *.o *.a .cpp.o: @echo -n "." @g++ $(CFLAGS) -c $< games-0.6.3/minesweeper/minesweeper.h0000644000076400001440000010704507730536743017231 0ustar clemensusers#ifndef _MINESWEEPER_H_ #define _MINESWEEPER_H_ #define SIZE 32 static const char t = COL_BGR; static const char w = COL_WHT; static const char r = COL_RED; static const char g = COL_GRN; static const char b = COL_BLU; static const char y = COL_YEL; static char icon[][SIZE][SIZE] = { { // zero { w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w }, { w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w,w }, { w,w,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,w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,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,b,b,b,b,w,w }, { w,w,b,b,b,b,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,b,b,b,b,w,w }, { w,w,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,w,w }, { w,w,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,w,w }, { w,w,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,w,w }, { w,w,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,w,w }, { w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w }, { w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w } } }; #endif games-0.6.3/minesweeper/minesweeper.cpp0000644000076400001440000001442410260055777017555 0ustar clemensusers/*****************************************************************************\ * * * Programm: Mines * * License: GPL (General Puplic License) * * Last Change: 2003-05-03 * * Authors: Gerard Monells * * Clemens Kirchgatterer * * * \*****************************************************************************/ #include #include #include #include "../display.h" #include "../defines.h" #include "minesweeper.h" typedef enum Direction { LEFT, RIGHT, UP, DOWN } Direction; typedef enum Icons { MINE = 9, EXPLODED, WRONG, HIDDEN, FLAG, ENIGMA, CURSOR, SHOWN, ICONS } Icons; static char field[16][12]; static char hidden[16][12]; static bool running, stopped; static int key; static int over, remaining, posx, posy, mines, width, height, skill; static void init_field(void) { int a, b, i, j, m = 0; for (j=0; j=0 && i+a=0 && j+b0) posx--; break; case RIGHT: if (posx0) posy--; break; case DOWN: if (posy=0 && x+i=0 && y+j * * Clemens Kirchgatterer * * * \*****************************************************************************/ #include #include #include #include "../display.h" #include "../defines.h" #define WIDTH 36 #define HEIGHT 27 #define EMPTY 0 #define FRUIT 1 #define SNAKE 2 static unsigned char field[HEIGHT][WIDTH]; static bool running, stopped; static int key; static int posx, posy, dirx, diry, length; static int score, level, fruits, halt, over, size; static void move_left() { dirx = -1; diry = 0; } static void move_right() { dirx = 1; diry = 0; } static void move_up() { dirx = 0; diry = -1; } static void move_down() { dirx = 0; diry = 1; } static void reset_game() { int x, y; posx = WIDTH/2; posy = HEIGHT/2; length = 3; fruits = 0; halt = 0; over = 0; score = 0; level = 1; switch (RAND(3)) { case 0: move_up(); break; case 1: move_down(); break; case 2: move_left(); break; case 3: move_right(); break; } for (y=0; y= SNAKE) { game_over(); return; } if ((posx < 0) || (posx > WIDTH-1) || (posy < 0) || (posy > HEIGHT-1)) { game_over(); return; } if (field[posy][posx] == FRUIT) { x = RAND(WIDTH-1); y = RAND(HEIGHT-1); field[y][x] = FRUIT; draw_block(x, y, COL_GRN); length += level; score += level; fruits += 1; if (fruits == 7) { if (level<9) level++; length = 3; fruits = 0; } } field[posy][posx] = SNAKE; for (y=0; y= SNAKE) { if (field[y][x] >= length + SNAKE) { field[y][x] = EMPTY; draw_block(x, y, COL_BGR); } else { ++field[y][x]; draw_block(x, y, COL_WHT); } } } } } int snake_start(int x, int y, int s, int c) { int X, Y, W, H; SRND(); size = 4*s; W = WIDTH*size; H = HEIGHT*size; X = DISPLAY_MINX+(int)((DISPLAY_MAXX-W-DISPLAY_MINX)*((x+9.0)/18.0)); Y = DISPLAY_MINY+(int)((DISPLAY_MAXY-H-DISPLAY_MINY)*((y+9.0)/18.0)); Dpy::open(X, Y, W, H); Dpy::status_center("Snake", COL_WHT); reset_game(); draw_field(); draw_score(); running = true; stopped = false; key = KEY_NONE; while (running) { switch (key) { case KEY_LEFT: move_left(); break; case KEY_RIGHT: move_right(); break; case KEY_UP: move_up(); break; case KEY_DOWN: move_down(); break; case KEY_BACK: running = false; break; case KEY_OK: halt_game(); break; case KEY_NONE: break; } key = KEY_NONE; usleep(10000+10000*(10-level)); if (halt || over) continue; if (running) { move_snake(); if (!over) { draw_score(); Dpy::update(); } } } Dpy::close(); stopped = true; return (0); } int snake_stop(void) { running = false; while (!stopped) usleep(10000); return (0); } int snake_key(int k) { key = k; // XXX maybe mutex lock or cond signal? if (key == KEY_BACK) { snake_stop(); return (1); } return (0); } games-0.6.3/tetris/0000755000076400001440000000000010425102105013465 5ustar clemensusersgames-0.6.3/tetris/Makefile0000644000076400001440000000032507730536743015155 0ustar clemensusersGAME = tetris OBJS = tetris.o CFLAGS = -g -pipe -O2 -Wall -Woverloaded-virtual all: $(OBJS) @ar -r $(GAME).a $(OBJS) clean: @echo -n "." @rm -rf *.o *.a .cpp.o: @echo -n "." @g++ $(CFLAGS) -c $< games-0.6.3/tetris/tetris.cpp0000644000076400001440000001454607730536743015545 0ustar clemensusers/*****************************************************************************\ * * * Programm: Tetris * * License: GPL (General Puplic License) * * Last Change: 2003-05-04 * * Authors: Franko Kulaga * * Clemens Kirchgatterer * * * \*****************************************************************************/ #include #include #include #include "../display.h" #include "../defines.h" #include "tetris.h" #define COLORS 14 #define WIDTH 10 #define HEIGHT 20 static unsigned char field[HEIGHT][WIDTH]; static unsigned char piece[4][2]; static bool running, stopped; static int key = KEY_NONE; static int score = 0; static int level = 0; static int lines = 0; static int pieces = 0; static int halt = 0; static int fallen = 0; static int over = 0; static int color = 0; static int size = 0; static void draw_block(int x, int y, int c) { int x1, y1, x2, y2; x1 = x*size; y1 = y*size; x2 = x*size+size; y2 = y*size+size; Dpy::rect_fill(x1, y1, x2, y2, c); } static void draw_score(void) { Dpy::status_left(score, COL_WHT); Dpy::status_right(level, COL_WHT); } static void game_over(void) { over = 1; Dpy::message_show("Game", "Over", COL_WHT); Dpy::update(); } static void init_field(void) { for (int y=0; y=0) lines = line; for (int y=0; y=HEIGHT)) { if (!fallen) game_over(); return (1); } } delete_piece(); for (int i=0; i<4; i++) { piece[i][1]++; } draw_piece(); draw_score(); Dpy::update(); fallen++; return (0); } static void move_piece(int dir) { if (halt) halt_game(); for (int i=0; i<4; i++) { if (field[piece[i][1]][piece[i][0]+dir]) return; if ((piece[i][0]+dir)<0) return; if ((piece[i][0]+dir)>WIDTH-1) return; } delete_piece(); for (int i=0; i<4; i++) { piece[i][0] += dir; } draw_piece(); draw_score(); Dpy::update(); } static void rotate_piece(void) { char tmp[4][2]; int x = WIDTH, y = HEIGHT; if (halt) halt_game(); for (int i=0; i<4; i++) { if (piece[i][0] < x) x = piece[i][0]; if (piece[i][1] < y) y = piece[i][1]; } for (int i=0; i<4; i++) { tmp[i][0] = x+(piece[i][1]-y); tmp[i][1] = 1+y-(piece[i][0]-x); } for (int i=0; i<4; i++) { if (field[(int)tmp[i][1]][(int)tmp[i][0]]) return; if ((tmp[i][0]) < 0) return; if ((tmp[i][0]) > WIDTH-1) return; if ((tmp[i][1]) < 0) return; if ((tmp[i][1]) > HEIGHT-1) return; } delete_piece(); for (int i=0; i<4; i++) { piece[i][0] = tmp[i][0]; piece[i][1] = tmp[i][1]; } draw_piece(); draw_score(); Dpy::update(); } static void flash_line(int line) { for (int i=0; i<4; i++) { for (int x=0; x0; i--) { for (int x=0; x9) level = 9; score += 3*level; draw_field(); draw_score(); Dpy::update(); } } } int tetris_start(int x, int y, int s, int c) { int X, Y, W, H; SRND(); size = 4+4*s; W = WIDTH*size; H = HEIGHT*size; X = DISPLAY_MINX+(int)((DISPLAY_MAXX-W-DISPLAY_MINX)*((x+9.0)/18.0)); Y = DISPLAY_MINY+(int)((DISPLAY_MAXY-H-DISPLAY_MINY)*((y+9.0)/18.0)); Dpy::open(X, Y, W, H); // Dpy::status_center("Tetris", COL_WHT); // XXX status line to short reset_game(); running = true; stopped = false; key = KEY_NONE; while (running) { for (int j=0; j<5; j++) { switch (key) { case KEY_LEFT: move_piece(-1); break; case KEY_RIGHT: move_piece(1); break; case KEY_UP: rotate_piece(); break; case KEY_DOWN: while (!drop_piece()); break; case KEY_BACK: running = false; break; case KEY_OK: halt_game(); break; case KEY_NONE: break; } key = KEY_NONE; usleep(17000+8000*(10-level)); if (!running) goto end; } if (halt || over) continue; if ((running) && (drop_piece())) { for (int i=0; i<4; i++) { field[piece[i][1]][piece[i][0]] = color; } remove_lines(); score += level; draw_score(); if (!over) init_piece(); } } end: Dpy::close(); stopped = true; return (0); } int tetris_stop(void) { running = false; while (!stopped) usleep(10000); return (0); } int tetris_key(int k) { key = k; // XXX maybe mutex lock or cond signal? if (key == KEY_BACK) { tetris_stop(); return (1); } return (0); } games-0.6.3/tetris/tetris.h0000644000076400001440000000120207730536743015173 0ustar clemensusers#ifndef _TETRIS_H_ #define _TETRIS_H_ unsigned char shapes[][4][4] = { { { 0, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 0, 0 } }, { { 0, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 } }, { { 0, 0, 1, 0 }, { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 } }, { { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 0 } }, { { 0, 0, 1, 0 }, { 0, 1, 1, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 } }, { { 0, 1, 1, 0 }, { 0, 1, 1, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }, { { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 1, 0, 0 }, { 0, 0, 0, 0 } } }; #endif // _TETRIS_H_ games-0.6.3/tictactoe/0000755000076400001440000000000010425102105014132 5ustar clemensusersgames-0.6.3/tictactoe/Makefile0000644000076400001440000000033307730536743015621 0ustar clemensusersGAME = tictactoe OBJS = tictactoe.o CFLAGS = -g -pipe -O2 -Wall -Woverloaded-virtual all: $(OBJS) @ar -r $(GAME).a $(OBJS) clean: @echo -n "." @rm -rf *.o *.a .cpp.o: @echo -n "." @g++ $(CFLAGS) -c $< games-0.6.3/tictactoe/tictactoe.cpp0000644000076400001440000003031207730555123016635 0ustar clemensusers/*****************************************************************************\ * * * Programm: TicTacToe * * License: GPL (General Puplic License) * * Last Change: 2003-04-21 * * Authors: Aaron Rogers * * Clemens Kirchgatterer * * * \*****************************************************************************/ #include #include #include #include #include "../bitmap.h" #include "../display.h" #include "../defines.h" #define SIZE 7 #define EMPTY 0 #define PLAYER1 1 #define PLAYER2 2 typedef enum Direction { LEFT, RIGHT, UP, DOWN } Direction; typedef enum PlayerType { HUMAN, COMPUTER } PlayerType; static unsigned char field[3][3]; static int score[3]; static bool running, stopped; static int key; static int posx, posy, skill, size, moves, plr; static Bitmap *bmpx, *bmpo; static void init_score(void) { plr = PLAYER1 + RAND(1); score[0] = 0; score[PLAYER1] = 0; score[PLAYER2] = 0; } static void init_field(void) { int x, y; for (x=0; x<3; x++) { for (y=0; y<3; y++) { field[y][x] = EMPTY; } } } static void init_x(void) { int x1, y1, ln; bmpx = new Bitmap(size*SIZE, size*SIZE); x1 = 2*size; y1 = 2*size; ln = size*SIZE-4*size; for (int i=0; ipixel(x1+j+i, y1+j-i, COL_WHT); bmpx->pixel(x1+j+i+1, y1+j-i, COL_WHT); bmpx->pixel(x1+j-i, y1+j+i, COL_WHT); bmpx->pixel(x1+j-i+1, y1+j+i, COL_WHT); bmpx->pixel(x1+j-i, y1-j-i+ln, COL_WHT); bmpx->pixel(x1+j-i+1, y1-j-i+ln, COL_WHT); bmpx->pixel(x1+j+i, y1-j+i+ln, COL_WHT); bmpx->pixel(x1+j+i+1, y1-j+i+ln, COL_WHT); } } } static void init_o(void) { int x1, y1, r1, r2, r3, dx, dy, dr; bmpo = new Bitmap(size*SIZE, size*SIZE); x1 = size*SIZE/2; y1 = size*SIZE/2; r1 = size*SIZE/2-size-1; r2 = r1*r1; for (dr=0; drpixel(x1+dx, y1+dy, COL_WHT); bmpo->pixel(x1-dx, y1+dy, COL_WHT); bmpo->pixel(x1+dx, y1-dy, COL_WHT); bmpo->pixel(x1-dx, y1-dy, COL_WHT); bmpo->pixel(x1+dy, y1+dx, COL_WHT); bmpo->pixel(x1-dy, y1+dx, COL_WHT); bmpo->pixel(x1+dy, y1-dx, COL_WHT); bmpo->pixel(x1-dy, y1-dx, COL_WHT); } } } static void clear_cell(int x, int y) { int x1, y1, x2, y2; x1 = x*(size*SIZE+size); y1 = y*(size*SIZE+size); x2 = x1+size*SIZE; y2 = y1+size*SIZE; Dpy::rect_fill(x1, y1, x2, y2, COL_BGR); } static void clear_field(void) { for (int i=0; i<3; i++) { clear_cell(i, 0); Dpy::update(); usleep(10000); } clear_cell(2, 1); Dpy::update(); usleep(10000); for (int i=0; i<3; i++) { clear_cell(2-i, 2); Dpy::update(); usleep(10000); } clear_cell(0, 1); Dpy::update(); usleep(10000); clear_cell(1, 1); Dpy::update(); usleep(10000); } static void draw_field(void) { int i, j, k, l, m; i = size*SIZE; j = size; k = 3*i+2*j; l = 2*i; m = 2*j; Dpy::rect_fill( 0, 0, k, k, COL_BGR); Dpy::rect_fill( i, 0, i+j, k, COL_WHT); Dpy::rect_fill(l+j, 0, l+m, k, COL_WHT); Dpy::rect_fill( 0, i, k, i+j, COL_WHT); Dpy::rect_fill( 0, l+j, k, l+m, COL_WHT); Dpy::status_center("TicTacToe", COL_WHT); } static void draw_cursor(int x, int y, int col) { int x1, y1, x2, y2; x1 = x*(size*SIZE+size); y1 = y*(size*SIZE+size); x2 = x1+size; y2 = y1+size*SIZE; Dpy::rect_fill(x1, y1, x2, y2, col); x2 = x1+size*SIZE; y2 = y1+size; Dpy::rect_fill(x1, y1, x2, y2, col); x1 = x1+size*SIZE-size; x2 = x1+size; y2 = y1+size*SIZE; Dpy::rect_fill(x1, y1, x2, y2, col); x1 = x*(size*SIZE+size); y1 = y1+size*SIZE-size; x2 = x1+size*SIZE; y2 = y1+size; Dpy::rect_fill(x1, y1, x2, y2, col); } static void move_cursor(Direction dir) { draw_cursor(posx, posy, COL_BGR); switch (dir) { case LEFT: if (posx>0) posx--; break; case RIGHT: if (posx<2) posx++; break; case UP: if (posy>0) posy--; break; case DOWN: if (posy<2) posy++; break; } draw_cursor(posx, posy, COL_BLU); Dpy::update(); } static void draw_piece(Bitmap *bmp, int x, int y) { int x1, y1; x1 = x*size*SIZE + x*size; y1 = y*size*SIZE + y*size; Dpy::bitmap_blit(bmp, x1, y1); } static void flash_column(int x) { Bitmap *bmp; for (int i=0; i<3; i++) { for (int y=0; y<3; y++) clear_cell(x, y); Dpy::update(); usleep(10000); for (int y=0; y<3; y++) { (field[y][x] == PLAYER1) ? bmp = bmpo : bmp = bmpx; draw_piece(bmp, x, y); } Dpy::update(); usleep(10000); } } static void flash_row(int y) { Bitmap *bmp; for (int i=0; i<3; i++) { for (int x=0; x<3; x++) clear_cell(x, y); Dpy::update(); usleep(10000); for (int x=0; x<3; x++) { (field[y][x] == PLAYER1) ? bmp = bmpo : bmp = bmpx; draw_piece(bmp, x, y); } Dpy::update(); usleep(10000); } } static void flash_diagonal(int d) { Bitmap *bmp; for (int i=0; i<3; i++) { for (int j=0; j<3; j++) { (d) ? clear_cell(2-j, j) : clear_cell(j, j); } Dpy::update(); usleep(10000); for (int j=0; j<3; j++) { if (d) { (field[2-j][j] == PLAYER1) ? bmp = bmpo : bmp = bmpx; draw_piece(bmp, 2-j, j); } else { (field[j][j] == PLAYER1) ? bmp = bmpo : bmp = bmpx; draw_piece(bmp, j, j); } } Dpy::update(); usleep(10000); } } static bool check_win(int p) { bool won; for (int x=0; x<3; x++) { won = true; for (int y=0; y<3; y++) { if (field[y][x] != p) won = false; } if (won) { flash_column(x); return (true); } } for (int y=0; y<3; y++) { won = true; for (int x=0; x<3; x++) { if (field[y][x] != p) won = false; } if (won) { flash_row(y); return (true); } } won = true; for (int i=0; i<3; i++) { if (field[i][i] != p) won = false; } if (won) { flash_diagonal(0); return (true); } won = true; for (int i=0; i<3; i++) { if (field[2-i][i] != p) won = false; } if (won) { flash_diagonal(1); return (true); } return (false); } static void reset_game(void) { moves = 0; posx = posy = 1; init_score(); init_field(); draw_field(); draw_cursor(posx, posy, COL_BLU); Dpy::update(); } static void place_mark(int x, int y) { int winner; if (field[y][x] == EMPTY) { moves++; if (plr == PLAYER1) { draw_piece(bmpo, x, y); field[y][x] = PLAYER1; winner = PLAYER1; plr = PLAYER2; } else { draw_piece(bmpx, x, y); field[y][x] = PLAYER2; winner = PLAYER2; plr = PLAYER1; } Dpy::update(); if (check_win(winner)) { score[winner]++; reset_game(); } else { if (moves >= 9) { score[0]++; clear_field(); reset_game(); } } } } static int who(int i) { return (field[i/3][i%3]); } static int other_player(void) { if (plr == PLAYER1) return (PLAYER2); return (PLAYER1); } static bool win_move(int x, int pl) { if ((x==0) && ((who(1)==pl) && (who(2)==pl))) return (true); if ((x==0) && ((who(3)==pl) && (who(6)==pl))) return (true); if ((x==0) && ((who(4)==pl) && (who(8)==pl))) return (true); if ((x==1) && ((who(0)==pl) && (who(2)==pl))) return (true); if ((x==1) && ((who(4)==pl) && (who(7)==pl))) return (true); if ((x==2) && ((who(0)==pl) && (who(1)==pl))) return (true); if ((x==2) && ((who(4)==pl) && (who(6)==pl))) return (true); if ((x==2) && ((who(5)==pl) && (who(8)==pl))) return (true); if ((x==3) && ((who(0)==pl) && (who(6)==pl))) return (true); if ((x==3) && ((who(4)==pl) && (who(5)==pl))) return (true); if ((x==4) && ((who(0)==pl) && (who(8)==pl))) return (true); if ((x==4) && ((who(1)==pl) && (who(7)==pl))) return (true); if ((x==4) && ((who(2)==pl) && (who(6)==pl))) return (true); if ((x==4) && ((who(3)==pl) && (who(5)==pl))) return (true); if ((x==5) && ((who(2)==pl) && (who(8)==pl))) return (true); if ((x==5) && ((who(3)==pl) && (who(4)==pl))) return (true); if ((x==6) && ((who(0)==pl) && (who(3)==pl))) return (true); if ((x==6) && ((who(2)==pl) && (who(4)==pl))) return (true); if ((x==6) && ((who(7)==pl) && (who(8)==pl))) return (true); if ((x==7) && ((who(1)==pl) && (who(4)==pl))) return (true); if ((x==7) && ((who(6)==pl) && (who(8)==pl))) return (true); if ((x==8) && ((who(0)==pl) && (who(4)==pl))) return (true); if ((x==8) && ((who(2)==pl) && (who(5)==pl))) return (true); if ((x==8) && ((who(6)==pl) && (who(7)==pl))) return (true); return (false); } static int move_to_win(int pl) { for (int i=0; i<9; i++) { if ((who(i)==EMPTY) && (win_move(i, pl))) return (i); } return (-1); } static int move_to_block(int pl) { pl = other_player(); for (int i=0; i<9; i++) { if ((who(i)==EMPTY) && (win_move(i, pl))) return (i); } return (-1); } static int move_to_good(int pl) { char tmp[4]; int j = 0; pl = other_player(); if (moves==1) { if (who(4)==EMPTY) return (4); } if (moves == 3) { if ((who(0)==pl) && (who(8)==pl) || (who(2)==pl) && (who(6)==pl)) { if (who(1)==EMPTY) tmp[j++] = 1; if (who(3)==EMPTY) tmp[j++] = 3; if (who(5)==EMPTY) tmp[j++] = 5; if (who(7)==EMPTY) tmp[j++] = 7; if (j) return (tmp[RAND(j-1)]); } if (((who(1)==pl) && (who(3)==pl)) || ((who(1)==pl) && (who(6)==pl)) || ((who(2)==pl) && (who(3)==pl))) { if (who(0)==EMPTY) return (0); } if (((who(1)==pl) && (who(5)==pl)) || ((who(1)==pl) && (who(8)==pl)) || ((who(0)==pl) && (who(5)==pl))) { if (who(2)==EMPTY) return (2); } if (((who(0)==pl) && (who(7)==pl)) || ((who(3)==pl) && (who(7)==pl)) || ((who(3)==pl) && (who(8)==pl))) { if (who(6)==EMPTY) return (6); } if (((who(2)==pl) && (who(7)==pl)) || ((who(5)==pl) && (who(6)==pl)) || ((who(5)==pl) && (who(7)==pl))) { if (who(8)==EMPTY) return (8); } } return (-1); } static int move_to_corner(int pl) { char tmp[4]; int j = 0; if (who(0)==EMPTY) tmp[j++] = 0; if (who(2)==EMPTY) tmp[j++] = 2; if (who(6)==EMPTY) tmp[j++] = 6; if (who(8)==EMPTY) tmp[j++] = 8; if (j) return (tmp[RAND(j-1)]); return (-1); } static int move_to_center(int pl) { if (who(4)==EMPTY) return (4); return (-1); } static int move_to_free(int pl) { char tmp[9]; int j = 0; for (int i=0; i<9; i++) { if (who(i)==EMPTY) tmp[j++] = i; } if (j) return (tmp[RAND(j-1)]); return (-1); } static int computer_move(int &x, int &y) { int spot = -1; switch (skill) { case 1: if (RAND(1) && (spot = move_to_win(plr)) != -1) break; if (RAND(1) && (spot = move_to_block(plr)) != -1) break; break; case 2: if ((spot = move_to_win(plr)) != -1) break; if ((spot = move_to_block(plr)) != -1) break; break; case 3: if ((spot = move_to_win(plr)) != -1) break; if ((spot = move_to_block(plr)) != -1) break; if ((spot = move_to_good(plr)) != -1) break; if ((spot = move_to_corner(plr)) != -1) break; if ((spot = move_to_center(plr)) != -1) break; break; } if (spot == -1) spot = move_to_free(plr); x = spot%3; y = spot/3; return (-1); } int tictactoe_start(int x, int y, int s, int c) { int X, Y, W, H; SRND(); size = 4*s; skill = c; W = 3*size*SIZE+2*size; H = 3*size*SIZE+2*size; X = DISPLAY_MINX+(int)((DISPLAY_MAXX-W-DISPLAY_MINX)*((x+9.0)/18.0)); Y = DISPLAY_MINY+(int)((DISPLAY_MAXY-H-DISPLAY_MINY)*((y+9.0)/18.0)); Dpy::open(X, Y, W, H); init_x(); init_o(); reset_game(); running = true; stopped = false; key = KEY_NONE; while (running) { if (plr == PLAYER1) { computer_move(x, y); // XXX move cursor to x, y place_mark(x, y); } switch (key) { case KEY_OK: place_mark(posx, posy); usleep(250000); break; case KEY_LEFT: move_cursor(LEFT); break; case KEY_RIGHT: move_cursor(RIGHT); break; case KEY_UP: move_cursor(UP); break; case KEY_DOWN: move_cursor(DOWN); break; case KEY_BACK: running = false; break; case KEY_NONE: break; } key = KEY_NONE; usleep(10000); } delete (bmpx); delete (bmpo); Dpy::close(); stopped = true; return (0); } int tictactoe_stop(void) { running = false; while (!stopped) usleep(10000); return (0); } int tictactoe_key(int k) { key = k; // XXX maybe mutex lock or cond signal? if (key == KEY_BACK) { tictactoe_stop(); return (1); } return (0); } games-0.6.3/tron/0000755000076400001440000000000010425102105013135 5ustar clemensusersgames-0.6.3/tron/Makefile0000644000076400001440000000032107730536743014621 0ustar clemensusersGAME = tron OBJS = tron.o CFLAGS = -g -pipe -O2 -Wall -Woverloaded-virtual all: $(OBJS) @ar -r $(GAME).a $(OBJS) clean: @echo -n "." @rm -rf *.o *.a .cpp.o: @echo -n "." @g++ $(CFLAGS) -c $< games-0.6.3/tron/tron.cpp0000644000076400001440000002016707730554767014667 0ustar clemensusers/*****************************************************************************\ * * * Programm: Tron * * License: GPL (General Puplic License) * * Last Change: 2003-04-21 * * Authors: Rhett D. Jacobs * * Clemens Kirchgatterer * * * \*****************************************************************************/ #include #include #include #include "../display.h" #include "../defines.h" #define WIDTH 36 #define HEIGHT 27 #define EMPTY 0 #define PLAYER1 1 #define PLAYER2 2 #define _A_ (index[0] < WIDTH && index[0] >= 0) #define _B_ (index[1] < HEIGHT && index[1] >= 0) #define _C_ (field[index[1]][index[0]] == 0) typedef enum Direction { LEFT, RIGHT, UP, DOWN } Direction; typedef enum PlayerType { HUMAN, COMPUTER } PlayerType; typedef struct Player { int posx; int posy; int score; int alive; Direction dir; PlayerType type; } Player; static char field[HEIGHT][WIDTH]; static Player player[2]; static bool running, stopped; static int key; static int level, over, halt, next, skill, size; static void init_player(void) { for (int i=0; i<2; i++) { player[i].alive = true; player[i].score = 0; player[i].posy = HEIGHT/2; } player[0].dir = LEFT; player[0].type = HUMAN; player[0].posx = (WIDTH/2)-3; player[1].dir = RIGHT; player[1].type = COMPUTER; player[1].posx = (WIDTH/2)+3; } static void init_field(void) { int x, y; for (x=0; x player[1].score) { Dpy::message_show("Game Over", "Yellow Wins", COL_WHT); } else { Dpy::message_show("Game Over", "Green Wins", COL_WHT); } Dpy::update(); } static void player_turn(Direction dir) { if (player[0].type == HUMAN) { switch (player[0].dir) { case LEFT: if (dir != RIGHT) player[0].dir = dir; case RIGHT: if (dir != LEFT) player[0].dir = dir; case UP: if (dir != DOWN) player[0].dir = dir; case DOWN: if (dir != UP) player[0].dir = dir; } } } static bool will_crash(int p, int x, int y) { if (field[player[p].posy+y][player[p].posx+x]) { return (true); } if (y && ((player[p].posy+y) >= HEIGHT || (player[p].posy+y) < 0)) { return (true); } if (x && ((player[p].posx+x) >= WIDTH || (player[p].posx+x) < 0)) { return (true); } return (false); } static void player_think(int p) { int index[2], flags[6] = { 0, 0, 0, 0, 0, 0 }; int dis_forward, dis_left, dis_right; Direction sides[2]; dis_forward = dis_left = dis_right = 1; switch (player[p].dir) { case LEFT: flags[0] = -1; flags[1] = 0; flags[2] = 0; flags[3] = 1; flags[4] = 0; flags[5] = -1; sides[0] = DOWN; sides[1] = UP; break; case RIGHT: flags[0] = 1; flags[1] = 0; flags[2] = 0; flags[3] = -1; flags[4] = 0; flags[5] = 1; sides[0] = UP; sides[1] = DOWN; break; case UP: flags[0] = 0; flags[1] = -1; flags[2] = -1; flags[3] = 0; flags[4] = 1; flags[5] = 0; sides[0] = LEFT; sides[1] = RIGHT; break; case DOWN: flags[0] = 0; flags[1] = 1; flags[2] = 1; flags[3] = 0; flags[4] = -1; flags[5] = 0; sides[0] = RIGHT; sides[1] = LEFT; break; } index[0] = player[p].posx+flags[0]; index[1] = player[p].posy+flags[1]; while (_A_ && _B_ && _C_) { dis_forward++; index[0] += flags[0]; index[1] += flags[1]; } if (dis_forward < skill) { dis_forward = 100 - 100/dis_forward; index[0] = player[p].posx+flags[2]; index[1] = player[p].posy+flags[3]; while (_A_ && _B_ && _C_) { dis_left++; index[0] += flags[2]; index[1] += flags[3]; } index[0] = player[p].posx+flags[4]; index[1] = player[p].posy+flags[5]; while (_A_ && _B_ && _C_) { dis_right++; index[0] += flags[4]; index[1] += flags[5]; } if (!(dis_left == 1 && dis_right == 1)) if (RAND(100) >= dis_forward || dis_forward == 0) { if (RAND(100) <= (100*dis_left)/(dis_left+dis_right)) { if (dis_left != 1) { player[p].dir = sides[0]; } else { player[p].dir = sides[1]; } } else { if (dis_right != 1) { player[p].dir = sides[1]; } else { player[p].dir = sides[0]; } } } } } static bool update_game(void) { int i; for (i=0; i<2; i++) { if (player[i].type == COMPUTER) player_think(i); switch (player[i].dir) { case LEFT: if (will_crash(i, -1, 0)) { player[i].alive = false; } else { player[i].posx--; } break; case RIGHT: if (will_crash(i, 1, 0)) { player[i].alive = false; } else { player[i].posx++; } break; case UP: if (will_crash(i, 0, -1)) { player[i].alive = false; } else { player[i].posy--; } break; case DOWN: if (will_crash(i, 0, 1)) { player[i].alive = false; } else { player[i].posy++; } break; } field[player[i].posy][player[i].posx] = PLAYER1+i; } draw_block(player[0].posx, player[0].posy, COL_YEL); draw_block(player[1].posx, player[1].posy, COL_GRN); if (!player[0].alive) player[1].score++; if (!player[1].alive) player[0].score++; draw_score(); Dpy::update(); for (i=0; i<2; i++) if (!player[i].alive) return (true); return (false); } int tron_start(int x, int y, int s, int c) { int X, Y, W, H; SRND(); skill = 3*c; size = 4*s; W = WIDTH*size; H = HEIGHT*size; X = DISPLAY_MINX+(int)((DISPLAY_MAXX-W-DISPLAY_MINX)*((x+9.0)/18.0)); Y = DISPLAY_MINY+(int)((DISPLAY_MAXY-H-DISPLAY_MINY)*((y+9.0)/18.0)); Dpy::open(X, Y, W, H); Dpy::status_center("Tron", COL_WHT); reset_game(); running = true; stopped = false; key = KEY_NONE; while (running) { switch (key) { case KEY_LEFT: player_turn(LEFT); break; case KEY_RIGHT: player_turn(RIGHT); break; case KEY_UP: player_turn(UP); break; case KEY_DOWN: player_turn(DOWN); break; case KEY_BACK: running = false; break; case KEY_OK: halt_game(); break; case KEY_NONE: break; } key = KEY_NONE; usleep(10000+6000*(10-level)); if (halt || over || next) continue; if (running && update_game()) { next = true; if ((player[0].score >= 9) || (player[1].score >= 9)) { game_over(); } level = player[0].score + 1; } } Dpy::close(); stopped = true; return (0); } int tron_stop(void) { running = false; while (!stopped) usleep(10000); return (0); } int tron_key(int k) { key = k; // XXX maybe mutex lock or cond signal? if (key == KEY_BACK) { tron_stop(); return (1); } return (0); } games-0.6.3/display.cpp0000644000076400001440000001231407730556524014354 0ustar clemensusers#include #include #include #include #include "defines.h" #include "screen.h" #include "text.h" #include "display.h" namespace Dpy { #define BORDERWIDTH 2 #define STATUSHEIGHT 32 static bool frame = false; static int W = -1; static int H = -1; static void frame_draw(void) { int i, x1, x2, y1, y2, y3, col = COL_RED; x1 = y1 = 0; x2 = W+BORDERWIDTH; y2 = BORDERWIDTH+STATUSHEIGHT; y3 = H+2*BORDERWIDTH+STATUSHEIGHT; for (int x=0; xblit(x, y)); } int line_draw(int x1, int y1, int x2, int y2, int col) { float xdiff, ydiff, x, y; if (frame) { x1 += BORDERWIDTH; y1 += 2*BORDERWIDTH+STATUSHEIGHT; x2 += BORDERWIDTH; y2 += 2*BORDERWIDTH+STATUSHEIGHT; } xdiff = x2 - x1; ydiff = y2 - y1; if (xdiff>ydiff) { y = y1; for (x=x1; x<=x2; x++) { y += ydiff/xdiff; Scr::pixel((int)x, (int)y, col); } } else { x = x1; for (y=y1; y<=y2; y++) { x += xdiff/ydiff; Scr::pixel((int)x, (int)y, col); } } return (0); } int status_left(const char *txt, int col) { static int x = 0, y = 0, w = 0, h = 0; for (int j=y; j<=y+h; j++) { for (int i=x; i<=x+w; i++) { Scr::pixel(i, j, 0); } } w=text_width(txt); h=text_height(); if (frame) { x = 2*BORDERWIDTH; y = BORDERWIDTH+((STATUSHEIGHT-h)/2); } else { x = 2; y = 2; } if (w text_width(txt2)) { w += text_width(txt1); } else { w += text_width(txt2); } } else { if (txt1) w += text_width(txt1); if (txt2) w += text_width(txt2); } if ((x=(W-w)/2)<0) { x=0; w=W; } if ((y=(H-h)/3)<0) { y=0; h=H; } rect_fill(x, y, x+w, y+h, bg); for (i=0; i<2; i++) line_draw(x+i, y, x+i, y+h, fg); for (i=0; i<2; i++) line_draw(x, y+h-i, x+w, y+h-i, fg); for (i=0; i<2; i++) line_draw(x+w-i, y, x+w-i, y+h, fg); for (i=0; i<2; i++) line_draw(x, y+i, x+w, y+i, fg); y += text_height()/4; if (txt1) { t = x+(w-text_width(txt1))/2; text_print(t, y, txt1, fg, bg); y += text_height(); } if (txt2) { t = x+(w-text_width(txt2))/2; text_print(t, y, txt2, fg, bg); } return (0); } } // namespace games-0.6.3/defines.h0000644000076400001440000000337507730633302013766 0ustar clemensusers#ifndef _DEFINES_H_ #define _DEFINES_H_ #include // srand() #include // time() #define SRND() srand(time(NULL)) #define RAND(MAX) (int)((float)(MAX+1)*rand()/(RAND_MAX+1.0)) #define GAME(NAME) int NAME ## _start(int x, int y, int s, int c); \ int NAME ## _stop(void); \ int NAME ## _key(int k); #define MENUSTART(TYPE,NAME) static TYPE NAME [] = { #define MENUEND() { NULL, NULL, NULL, NULL } }; #define MENUENTRY(NAME,PREFIX) { NAME , \ PREFIX ## _start, \ PREFIX ## _stop, \ PREFIX ## _key \ }, #define DISPLAY_MINX 36 #define DISPLAY_MINY 16 #define DISPLAY_MAXX 685 #define DISPLAY_MAXY 543 #define KEY_UP 0 #define KEY_DOWN 1 #define KEY_OK 3 #define KEY_BACK 4 #define KEY_LEFT 5 #define KEY_RIGHT 6 #define KEY_RED 7 #define KEY_GREEN 8 #define KEY_YELLOW 9 #define KEY_BLUE 10 #define KEY_0 11 #define KEY_1 12 #define KEY_2 13 #define KEY_3 14 #define KEY_4 15 #define KEY_5 16 #define KEY_6 17 #define KEY_7 18 #define KEY_8 19 #define KEY_9 20 #define KEY_NONE 0x1000 #define COL_BGR 0 #define COL_WHT 1 #define COL_RED 2 #define COL_CYN 3 #define COL_MAG 4 #define COL_GRN 5 #define COL_BLU 6 #define COL_YEL 7 #define COL_TRP 15 #define PAL_VDR 0 #define PAL_C64 1 #endif // _DEFINES_H_ games-0.6.3/screen.cpp0000644000076400001440000001304610054175665014165 0ustar clemensusers#include #include #include #ifdef SDL #include #else #include #endif #include "defines.h" #include "screen.h" #define DEPTH 4 #define COLORS 1<format, R, G, B)) #define PALETTE(I) (colortable[I]) #else #if VDRVERSNUM < 10307 #define COLOR(R,G,B,A) (R+(G<<8)+(B<<16)+(A<<24)) #define PALETTE(I) ((eDvbColor)colortable[I]) #else #define COLOR(R,G,B,A) (B+(G<<8)+(R<<16)+(A<<24)) #define PALETTE(I) ((tColor)colortable[I]) #endif #endif namespace Scr { #ifdef SDL static SDL_Surface *screen = NULL; #else #if VDRVERSNUM < 10307 static cOsdBase *screen = NULL; #else static cOsd *screen = NULL; #endif #endif static int W, H, colortable[COLORS], *shadow = NULL; static int palette(int pal) { switch (pal) { case PAL_VDR: colortable[0] = COLOR(0x00, 0x00, 0x00, 0x7F); // Background colortable[1] = COLOR(0xFC, 0xFC, 0xFC, 0xFF); // White colortable[2] = COLOR(0xFC, 0x14, 0x14, 0xFF); // Red colortable[3] = COLOR(0x00, 0xFC, 0xFC, 0xFF); // Cyan colortable[4] = COLOR(0xB0, 0x00, 0xFC, 0xFF); // Magenta colortable[5] = COLOR(0x24, 0xFC, 0x24, 0xFF); // Green colortable[6] = COLOR(0x00, 0x00, 0xFC, 0xFF); // Blue colortable[7] = COLOR(0xFC, 0xC0, 0x24, 0xFF); // Yellow colortable[8] = COLOR(0xC0, 0xA0, 0x00, 0xFF); // Orange colortable[9] = COLOR(0xFF, 0xA0, 0x00, 0xFF); // Orange2 colortable[10] = COLOR(0xF0, 0x80, 0x80, 0xFF); // Pink colortable[11] = COLOR(0x00, 0xFF, 0xFF, 0xFF); // Cyan2 colortable[12] = COLOR(0xFF, 0x00, 0xFF, 0xFF); // Purple2 colortable[13] = COLOR(0x00, 0xFF, 0x00, 0xFF); // Green2 colortable[14] = COLOR(0x00, 0xA0, 0xFF, 0xFF); // Blue2 colortable[15] = COLOR(0x00, 0x00, 0x00, 0xFF); // Black break; case PAL_C64: colortable[0] = COLOR(0x00, 0x00, 0x00, 0x7F); // Background colortable[1] = COLOR(0xFF, 0xFF, 0xFF, 0xFF); // White colortable[2] = COLOR(0xF0, 0x00, 0x00, 0xFF); // Red colortable[3] = COLOR(0x00, 0xF0, 0xF0, 0xFF); // Cyan colortable[4] = COLOR(0x60, 0x00, 0x60, 0xFF); // Purple colortable[5] = COLOR(0x00, 0xA0, 0x00, 0xFF); // Green colortable[6] = COLOR(0x00, 0x00, 0xF0, 0xFF); // Blue colortable[7] = COLOR(0xD0, 0xD0, 0x00, 0xFF); // Yellow colortable[8] = COLOR(0xC0, 0xA0, 0x00, 0xFF); // Orange colortable[9] = COLOR(0xFF, 0xA0, 0x00, 0xFF); // Orange2 colortable[10] = COLOR(0xF0, 0x80, 0x80, 0xFF); // Pink colortable[11] = COLOR(0x00, 0xFF, 0xFF, 0xFF); // Cyan2 colortable[12] = COLOR(0xFF, 0x00, 0xFF, 0xFF); // Purple2 colortable[13] = COLOR(0x00, 0xFF, 0x00, 0xFF); // Green2 colortable[14] = COLOR(0x00, 0xA0, 0xFF, 0xFF); // Blue2 colortable[15] = COLOR(0x00, 0x00, 0x00, 0xFF); // Black break; } #ifndef SDL for (int i=0; iAddColor(PALETTE(i)); #else if (screen) { screen->GetBitmap(0)->SetColor(i, PALETTE(i)); } #endif } #endif return (0); } int pixel(int x, int y, int idx) { if (!screen || x<0 || x>=W || y<0 || y>=H || idx<0 || idx>=COLORS) { return (-1); } if (shadow) shadow[W*y+x] = idx; #ifdef SDL unsigned int c, bpp; unsigned char *p; if (SDL_MUSTLOCK(screen)) if (SDL_LockSurface(screen)) return (-1); bpp = screen->format->BytesPerPixel; p = (unsigned char *)screen->pixels + y * screen->pitch + x * bpp; c = PALETTE(idx); switch (bpp) { case 1: *p = c; break; case 2: *(unsigned short *)p = c; break; case 3: if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { p[0] = (c >> 16) & 0xff; p[1] = (c >> 8) & 0xff; p[2] = (c & 0xff); } else { p[0] = (c & 0xff); p[1] = (c >> 8) & 0xff; p[2] = (c >> 16) & 0xff; } break; case 4: *(unsigned int *)p = c; break; } if (SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); #else #if VDRVERSNUM < 10307 screen->Fill(x, y, x, y, PALETTE(idx)); #else screen->DrawPixel(x, y, PALETTE(idx)); #endif #endif return (0); } int open(int x, int y, int w, int h) { if (screen) return (-1); if (x<0 || x>=800 || y<0 || y>=600) return (-1); if (w<=0 || w>800 || h<=0 || h>600) return (-1); W = w; H = h; #ifdef SDL unsigned int flg; flg = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; if (SDL_Init(flg)) return (-1); flg = SDL_SWSURFACE | SDL_ANYFORMAT; if (!(screen = SDL_SetVideoMode(W, H, 0, flg))) return (-1); SDL_ShowCursor(SDL_DISABLE); palette(PAL_VDR); #else #if VDRVERSNUM < 10307 tWindowHandle win; if (!(screen = cOsd::OpenRaw(x, y))) { if (!(screen = cOsd::OpenRaw(x, y))) { return (-1); } } win = screen->Create(0, 0, w, h, DEPTH); palette(PAL_VDR); screen->Show(win); screen->Flush(); #else tArea win = { 0, 0, w-1, h-1, DEPTH }; if (!(screen = cOsdProvider::NewOsd(x, y))) { if (!(screen = cOsdProvider::NewOsd(x, y))) { return(-1); } } screen->SetAreas(&win, 1); palette(PAL_VDR); screen->Flush(); #endif #endif if (!(shadow = (int *)calloc(W*H, sizeof (int)))) { return (-1); } for (int y=0; yFlush(); #endif return (0); } return (-1); } int pixel(int x, int y) { if (shadow) return (shadow[W*y+x]); return (-1); } int width(void) { if (screen) return (W); return (-1); } int height(void) { if (screen) return (H); return (-1); } } // namespace games-0.6.3/launcher.cpp0000644000076400001440000000315410071043360014467 0ustar clemensusers#include #include #include "defines.h" typedef struct Game { char *name; int (*start)(int, int, int, int); int (*stop)(void); int (*key)(int); } Game; typedef struct ThreadParam { int i, x, y, s, c; } ThreadParam; // function prototype factory GAME(tetris); GAME(tron); GAME(snake); GAME(tictactoe); GAME(minesweeper); // launcher menu factory MENUSTART(Game, menu) MENUENTRY("Tetris", tetris) MENUENTRY("Tron", tron) MENUENTRY("Snake", snake) MENUENTRY("TicTacToe", tictactoe) MENUENTRY("Minesweeper", minesweeper) MENUEND() static int game = -1; static char *games[32]; static void * launcher_thread(void *p) { ThreadParam *param; int x, y, s, c; param = (ThreadParam *)p; x = param->x; y = param->y; s = param->s; c = param->c; free(param); // call the games start function menu[game].start(x, y, s, c); return (NULL); } int launcher_menu(char ***m) { int i = 0; while (menu[i].name) { games[i] = menu[i].name; i++; } games[i] = NULL; *m = games; return (i); } int launcher_start(int g, int x, int y, int s, int c) { ThreadParam *param; pthread_t thr_id; game = g; param = (ThreadParam *)malloc(sizeof (ThreadParam)); param->x = x; param->y = y; param->s = s; param->c = c; pthread_create(&thr_id, NULL, &launcher_thread, (void *)param); pthread_detach(thr_id); return (0); } int launcher_stop(void) { if (game >= 0) { // call the games stop function return (menu[game].stop()); game = -1; } return (0); } int launcher_key(int key) { if (game >= 0) { // call the games event handler return (menu[game].key(key)); } return (0); } games-0.6.3/plugin.cpp0000644000076400001440000000700010260056470014164 0ustar clemensusers#include #include extern int launcher_menu(char ***m); extern int launcher_start(int g, int x, int y, int s, int c); extern int launcher_stop(void); extern int launcher_key(int key); class GameMenu; class GameStart; class GameSetup; class GamePlugin; static const char *DESCRIPTION = "OSD Games Collection"; static const char *MAINMENUENTRY = "Games"; static int x = -8; // x position static int y = -8; // y position static int s = 2; // osd size static int c = 2; // computer skill static int g = -1; // selected game static bool m = true; // open menu static bool r = false; // repeat keys class GameMenu : public cOsdMenu { public: GameMenu(void); eOSState ProcessKey(eKeys k); }; class GameStart : public cOsdObject { public: ~GameStart(void); void Show(void); eOSState ProcessKey(eKeys k); }; class GameSetup : public cMenuSetupPage { public: GameSetup(void); protected: void Store(void); private: int new_x, new_y, new_s, new_r, new_c; }; class GamePlugin : public cPlugin { public: bool SetupParse(const char *Name, const char *Value); const char *Version(void) { return VERSION; } const char *Description(void) { return DESCRIPTION; } const char *MainMenuEntry(void) { return MAINMENUENTRY; } cMenuSetupPage *SetupMenu(void) { return new GameSetup; } cOsdObject *MainMenuAction(void); }; GameMenu::GameMenu(void) : cOsdMenu("Games") { char **menu; int games; SetHasHotkeys(); games = launcher_menu(&menu); for (int i=0; i Project's homepage: http://www.1541.org Latest version available at: http://www.1541.org See the file COPYING for license information. Description: OSD Games Collection ------------------------------------------------------------------------------ This is the new vdr OSD games collection formaly known as the tetris plugin. The collection currently contains Tetris, Tron, TicTacToe, Snake and Minesweeper, more to come. ;-) The plugin will be built as a "Stand Alone SDL" program, when it finds "sdl-config" in your $PATH. Very handy for debugging and testing. I would like to hear your opinion, feature request or suggestions and also will be very pleased to receive your patches, betterments or new game implementations. ------------------------------------------------------------------------------ Keys: LEFT -> move left RIGHT -> move right UP -> move up / rotate piece (tetris) DOWN -> move down / drop piece (tetris) BACK -> quit game OK -> pause/restart NUMBER KEYS -> 1 - show, 2 - place enigma, 3 - mark mine Setup: Block Size -> in pixels multiplied with 4 X-Position & Y-Position -> cartesian coordinates of OSD (0,0 = centered) Computer Skill -> level of AI smartness for computer enemy Key Repeat -> send repeated keycodes, when key is held down ------------------------------------------------------------------------------ Credits: Most games are based on simple Open Source versions of their famose originals. I have rewritten, changed, removed and/or added large parts of the source. Nevertheless I used code from the following people, so my thanks go to: Justin Todd (Snake) Franko Kulaga (Tetris) Rhett D. Jacobs (Tron) Aaron Rogers (TicTacToe) Gerard Monells (Minesweeper) games-0.6.3/Makefile0000644000076400001440000000515210425075573013640 0ustar clemensusersPLUGIN = games VERSION = 0.6.3 GAMES = minesweeper \ tictactoe \ tetris \ snake \ tron OBJS = launcher.o \ display.o \ screen.o \ bitmap.o \ text.o VDROBJS = plugin.o SDLOBJS = main.o DEFINES = -DVERSION=\"$(VERSION)\" CFLAGS = -g -pipe -O2 -Wall -Woverloaded-virtual LFLAGS = -pthread VDRDIR = ../../.. LIBDIR = ../../lib DVBDIR = ../../../../DVB PACKAGE = vdr-games-$(VERSION) ARCHIVES = $(shell for GAME in $(GAMES); do echo $$GAME/$$GAME.a; done) SDLGAMES = $(shell test -f $(VDRDIR)/config.h || echo true ) VDRVER = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | \ awk '{ print $$3 }' | sed -e 's/"//g' ) VDRNUM = $(shell grep 'define VDRVERSNUM ' $(VDRDIR)/config.h | \ awk '{ print $$3 }' | sed -e 's/"//g' ) ifeq "$(SDLGAMES)" "true" TARGET = sdl-games OBJS += $(SDLOBJS) CFLAGS += `sdl-config --cflags` LFLAGS += `sdl-config --libs` DEFINES += -DSDL -DVERBOSE else # The version number of VDR's plugin API (taken from VDR's "config.h"): APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h) # This is required for VDRs older than 1.3.47 ifeq ($(strip $(APIVERSION)),) APIVERSION = $(shell sed -ne '/define VDRVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h) endif -include $(VDRDIR)/Make.config TARGET = libvdr-games.so OBJS += $(VDROBJS) CFLAGS += -fPIC -I$(VDRDIR) -I$(DVBDIR)/include LFLAGS += -shared --whole-archive DEFINES += -D_GNU_SOURCE -DVDRVERSNUM=$(VDRNUM) endif all: @echo @echo -n "Building $(TARGET) " @for GAME in $(GAMES); do cd $$GAME; make -s all; cd -; done @rm -f $(TARGET) @make -s $(TARGET) @echo " done" @echo libvdr-games.so: $(OBJS) @g++ $(OBJS) $(LFLAGS) $(ARCHIVES) -o $@ @cp $@ $(LIBDIR)/$@.$(APIVERSION) sdl-games: $(OBJS) @g++ $(OBJS) $(LFLAGS) $(ARCHIVES) -o $@ install: all @cp $(LIBDIR)/libvdr-games.so.$(VDRVER) /mnt/vdr/lib/plugins/ tar: clean @echo -n "Creating archive ..." @cd .. ; cp -a vdr-games games-$(VERSION) @cd .. ; for GAME in $(GAMES); do rm -rf games-$(VERSION)/$$GAME/CVS; done @cd .. ; rm -rf games-$(VERSION)/CVS @cd .. ; tar cfz $(PACKAGE).tar.gz games-$(VERSION) @cd .. ; rm -rf games-$(VERSION) @echo " done" @echo clean: @echo @echo -n "Cleaning source tree " @for GAME in $(GAMES); do cd $$GAME; make -s clean; cd -; done @rm -f *.o *.a $(TARGET) @echo " done" @echo .cpp.o: @echo -n "." @$(COMPILE.cpp) $(DEFINES) $(CFLAGS) -c $< $(OUTPUT_OPTION) games-0.6.3/main.cpp0000644000076400001440000000370110425100715013611 0ustar clemensusers#include #include #include #include #include #include #include "defines.h" extern int launcher_menu(char ***m); extern int launcher_start(int g, int x, int y, int s, int c); extern int launcher_stop(void); extern int launcher_key(int key); int main(int argc, char **argv) { int games, events, size, game, skill; bool running = true, quit = false; Display *display = NULL; SDL_SysWMinfo info; char **menu; XEvent xev; KeySym key; games = launcher_menu(&menu); if (argc != 4) { printf("\nUSAGE: games \n\n"); for (int i=0; i games) game = games; if (game < 1) game = 1; if (size > 3) size = 3; if (size < 1) size = 1; if (skill > 3) skill = 3; if (skill < 1) skill = 1; launcher_start(game-1, 0, 0, size, skill); sleep(1); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) <= 0) exit(-1); display = info.info.x11.display; while (running) { info.info.x11.lock_func(); XFlush(display); events = XPending(display); while (events--) { XNextEvent(display, &xev); if (xev.type == KeyPress) { key = XLookupKeysym(&xev.xkey, 0); switch (key) { case XK_Left: quit = launcher_key(KEY_LEFT); break; case XK_Right: quit = launcher_key(KEY_RIGHT); break; case XK_Up: quit = launcher_key(KEY_UP); break; case XK_Down: quit = launcher_key(KEY_DOWN); break; case XK_Return: quit = launcher_key(KEY_OK); break; case XK_Escape: quit = launcher_key(KEY_BACK); break; default: if ((key >= XK_0) && (key <= XK_9)) { quit = launcher_key(key-XK_0+KEY_0); } break; } if (quit) return (0);; } } info.info.x11.unlock_func(); usleep(5000); // 5 ms } return (0); } games-0.6.3/HISTORY0000644000076400001440000000570310425102073013250 0ustar clemensusers'VDR-Games Plugin' Revision History ----------------------------------- 2002-11-01: Version 0.0.1 initial revision. 2002-11-01: Version 0.1.0 display current score implemented pause button 2002-11-01: Version 0.1.1 display current level fixed restart bug prevent falling through of first piece 2002-11-02: Version 0.1.2 fixed to late initialization of random generator avoid crash when pressing "menu" while playing game ends when stack reaches top display game over message terminate cleanly if in pause mode 2002-11-09: Version 0.1.3 many general code clean/speed ups implemented key repeating key repeat on/off setup menu colorful pieces implemented color mode setup menue fixed overwriting of game over by new (last) piece show pause mode new handling of x/y position setup menu 2002-11-19: Version 0.2.0 start/stop code rewritten minor code cleaning for stable release 2002-12-30: Version 0.2.1 SDL Output support added (for development & debuging) 2003-04-06: Version 0.4.0 changed plugin name to "vdr games" added snake game added tron game implemented laucher menu completely rewritten SDL key handling to avoid #ifdef pollution major source reorganisation for better code sharing between the games 2003-04-21: Version 0.4.1 added DVB include path to default include path changed internal plugin class names removed "Colors" setup parameter added "Computer Skill" setup parameter print usage for SDL version added TicTacToe game fixed bug in Tron AI, that let it crash unexpectedly unified OSD size calculation 2003-07-12: Version 0.4.2 speed optimised snake added DisplayPixelSet() function to OSD functions replaced game specific header files with a prototype factory fixed missleading logging of wrong Setup Options fixed race condition when closing the OSD added minesweeper game fixed Segfault when pressing [ESC] in SDL version generally slowed down game speed 2003-09-13: Version 0.6.0 splitted drawing code into backend dependent/independent removed "make SDL=1" (gets autodetected now) color handling rewritten completely (makes schemes possible) moved each game into its own subdirectory added game over message to minesweeper seperated score/level/status display from field display common message box for pause, game over, ... implemented font render engine (partly stolen from vdr) removed font code from SDL backend (avoids SDL_ttf dependency) fixed long standing rect_fill() drawing code source code completely restructured major faceliftings for all games implemented menu factory macros for launcher.cpp 2004-05-23: Version 0.6.1 updated to work with vdr >1.3.7 (thx Sascha Volkenandt) fixed compile error by adding -D_GUN_SOURCE (thx Manfred Schmidt-Voigt) 2005-06-27: Version 0.6.2 fixed compile error with gcc 3.4.3 (thx Ronny Kornexl) fixed crash when entering main menu a second time updated README regarding URL and email 2006-04-30: Version 0.6.3 fixed broken compilation for vdr > 1.3.47 (thx Ronny Kornexl) avoid hoging cpu in SDL version by usleeping in mainloop