wader/gtktetris

macOS support

wader opened this issue · 10 comments

wader commented

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.

Screen Shot 2020-12-12 at 10 45 58

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:

  • Cmd-Q to quit is not working
  • Main and high-score show up in the top left corner
  • A bit annoying with high-score popping up after game ends, why did i do it like that? :) not sure what alternatives there are
  • Show next block is no enabled by default, it should i think?
  • Maybe remove the "Save settings" button and instead just always save settings?
  • Move "Show next block" into settings dialog? then maybe can remove "Settings" menu and have it under "Game" menu instead?
wader commented

Oh now i noticed the note about gtk3 not working in the README, sorry

I think I applied all your suggestions, try the app again and see what can be improved..

I also made the GTK3 port compile, but it's currently broken, it will take some time to fix it.

I've always thought GTK2 is the best gtk version.

wader commented

Work fine. Cmd+Q seems to still be broken, seems some kind of primary mask etc is needed?

Sorry was long time since i did anything with GTK. Maybe ill do some digging also

It's hard to tell what's wrong, I don't use macOS, and GTK works as intended probably only on Linux.

I remember @sedwards said that GTK keyboard handling is somewhat broken on macOS. So they have to fix stuff and provide a new release.

The git logs show that I've been making simple edits to GTK apps since 2018, only deleting code to avoid fixing stuff I don't understand, nothing like I've done here... which is true development.

Well, it's taken me a whole year to learn basic stuff, editing several projects, low level edits without a GTK RAD like Glade or something... and that's really painful. And I need to learn a lot more.

But this method is quite powerful, as it helps understand how to update old forgotten projects and support several GTK generations, that's why I also like simple projects.

The GTK3 port now works on Linux, it probably needs some tests on macOS.

A new "topic" or "label" for the project is required: gtk3.

One of these days I'll see if I can make it compile for Windows using Mingw32.

wader commented

The GTK3 port now works on Linux, it probably needs some tests on macOS.

Builds and works, good work!

A new "topic" or "label" for the project is required: gtk3.

Fixed

One of these days I'll see if I can make it compile for Windows using Mingw32.

:)

I searched "gtk game" and this app does not appear in the results. I suggest changing the project description to "Simple GTK tetris game" and/or maybe a new topic(s): game / games

Do you know other old gtk games that maybe are now forgotten?

I'm aware of xemeraldia, I'll perform some updates to that app.

wader commented

Good suggestion, have changed to "Simple GTK tetris game" and added game tag.

Nothing comes to mind right away but i will think about it.

Hope you had nice holidays!

Yeah I had, thanks, and happy new year to you.

I think some games are truly lost or something, I've read about them, but I can't find the source, maybe it's somewhere in a linux source repository.

https://github.com/wdlkmpx/xemeraldia

xEmeraldia is a similar game to GtkTetris, it was last updated in 2009, but it might be way harder to port to gtk3, you might want to see if it compiles on macOS, it's a nice game.