wader / gtktetris Goto Github PK
View Code? Open in Web Editor NEWSimple GTK tetris game
Home Page: https://github.com/wader/gtktetris
License: MIT License
Simple GTK tetris game
Home Page: https://github.com/wader/gtktetris
License: MIT License
Currently there is a problem with config files and stuff.
HIGHSCORE_PATH = /usr/local/games/gtktetris
Config files, stats, should be in:
$XDG_CONFIG_HOME/gtktetris/
The app must just assume that only 1 system user is going to use it. When it comes to names, perhaps there should be a dialog to specify a name.
I suggest changing the License to ISC or MIT.
https://opensource.org/licenses/ISC
If you agree with this, I can add a new LICENSE file and update the readme.
A build system would benefit the project greatly.
Something that works in old and new distros without the need of updates ... autotools perhaps.
To keep things in order, the source files should be moved to a new dir src/
Years ago I used to play Tetris at https://tetrisfriends.com/ and Tetris Battle at Facebook (the same game).
I noticed a similar game can be found at tetris.com.
The keys in GtkTetris are mostly OK, except the Down arrow key with the hard drop.
I guess this image can be used in the Help dialog and the keys can be adjusted accordingly.
HOLD - C is probably not implemented.
This is some technical info. Ideally the app should work fine in very slow machines.
Currently there are 2 block types (see Options dialog):
The "image" block used to be faster with gdk_draw, using GdkPixmap, but now using only cairo it's slower. I notice visual glitches.
The reason for this is cairo_set_source_surface()
https://stackoverflow.com/questions/15773965/how-to-fast-redrawing-an-image-buffer
The "generated" block is fast, because it doesn't use cairo_set_source_surface()
, which is slow with X.
So this is something to think about. There might be some workarounds or a different way to accelerate the drawing of the image blocks, which can be from .xpm, .svg, .png, .etc files.
I remember having some idea about getting rid of GDK_SCALE
and instead just scale the block images maybe using SVG etc.
I can see if i can brush off my inkscape skills and draw some scaleable blocks SVGs
This might not happen but is worth considering.
The project is small enough to try to compile it with mingw32 (msys) and produce some MS Windows binaries...
This requires some changes, specially to paths and who knows what else.
GTK3 support while keeping gtk2 is feasible.
With a special gtkcompat.h things can become mostly gtk3 while still compiling with gtk2, and probably supporting gtk2+.
It might take a few days or weeks or months... some deprecated functions are a bit (or too) hard to replace (i.e GdkPixmap/Drawable to Cairo).
Great work! had a quick look at building on macOS
Builds and works fine with brew gtk+
formula (gtk 2), only had to change autogen.sh
to use glibtoolize
.
With GTK 3 (gtk+3
formula) I get a bunch of errors about undefined GDK_*
identifiers and some about duplicate switch cases (maybe errors is confusing because it's trying to helpful with typos?).
...
interface.c:104:26: error: use of undeclared identifier 'GDK_Down'; did you mean 'GDK_DOT'?
case GDK_space: case GDK_Down:
^~~~~~~~
GDK_DOT
/usr/local/Cellar/gtk+3/3.24.24/include/gtk-3.0/gdk/gdkcursor.h:155:3: note: 'GDK_DOT' declared here
GDK_DOT = 38,
^
interface.c:79:22: error: duplicate case value 'GDK_OK'
case GDK_x: case GDK_X:
^
...
Some other things i noticed:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.