davidjoffe / dave_gnukem

Dave Gnukem is a cross-platform 2D scrolling platform shooter inspired by Duke Nukem 1
GNU General Public License v2.0
75 stars 22 forks source link

Game screen not stretched with the window anymore #138

Open jmfergeau opened 1 year ago

jmfergeau commented 1 year ago

I don't know what happened with xorg or my driver or whatever but, suddenly, after months of displaying it correctly, now it doesn't stretch the game's window as intended, making it practically unplayable on big screens.

Screenshot_20221009_135348

I tried fullscreen, scaling, even the -640 but nothing fixes it...

Thanks

pocak100 commented 1 year ago

It's the same for me.

I don't know if SDL or x.org or something else changed, but the problem is that now SDL 1.2 gives a 24-bit surface by default instead of 32 bits (with an unused alpha channel). According to a comment, currently the game can only upscale from the latter. See sdl/djgraph.cpp line 212:

&& pVisSrc->pSurface->format->BytesPerPixel == 4//Current scaling blit implementation only supports 4BPP [dj2016-10] [TODO: Handle other format, OR if upgrading to libsdl2, just use libsdl's scale blit function]

A quick hack to get it to work is to explicitly ask SDL for a 32-bit surface. E.g. change graph.cpp end of line 184 to

    if (NULL == (pVisMain = djgOpenVisual( bFullScreen?"fullscreen":NULL, iWidth, iHeight, 32)))

That does the trick for me, but may not be optimal. There's also a pull request for SDL 2.0 that sidesteps the issue.

davidjoffe commented 1 year ago

Hi, sorry (haven't had time to look closely at this as I'm extremely busy with real life work and others demands right now and unfortunately only have a few spare minutes a day unfortunately for Dave Gnukem game as it's free) but just want to comment, there have been some recent commits from other contributors to add Debian support (which is obviously very valuable and helpful) but I suspect there's a chance the changes (e.g. Makefile changes) may possibly break current builds ... we'll unfortunately just need to please test (if you can) and if there are conflicts or build breakages try solve them and deal with them as they come up, see my comments here, thanks so much:

https://github.com/davidjoffe/dave_gnukem/pull/131

davidjoffe commented 1 year ago

It's 'likely' I'll soon be integrating Matteo Bini's implementation of updating Dave Gnukem to SDL2 and this may change slightly again - I don't know if it'll fix it also as it also has that addition of requesting 32-bit surface so perhaps - this should all be tested again after the SDL2 update

davidjoffe commented 1 year ago

@pocak100 Thanks for the quickfix!

davidjoffe commented 1 year ago

Hi all, please try the latest version (SDL2 support and which also includes that line) and report if this is still an issue or if it's solved? Thanks

jmfergeau commented 1 year ago

Tested on my arch, worked like a charm to me. Thanks ^^

davidjoffe commented 1 year ago

Thanks so much! That really helps to know. Let me know if you may be interested in having direct contributor access to Dave Gnukem repo?

I see your profile it says: "I'm also a software translator french-english, an opensource lover and I develop videogames as a hobby."

It just happens I've been thinking lately of possibly implementing support for translated/localized versions of Dave Gnukem, and it just happens literally this morning I was thinking of some possible nice solutions to relatively easily add support to possibly create a French localized version of Dave Gnukem ... a French version would be very cool!

Let me know if you'd be interested in helping do translations? That would be really awesome, to have a French Dave Gnukem.

I've started working on the localization support in the game backend, and even grabbed some French text from Google Translate (yes I know, horrible bad translations, not valid for actual localization, it was just to test the code changes and work on the code side of things) to help test potential support in some screenshots the other day.

2022-11-28 16_50_59-Dave Gnukem

This is just to give you the idea, but imagine the above but with good proper translations

I don't know French unfortunately so I can't even rate the translations but yes I know Google Translate is NOT suitable for "real things" if not at least signed off by real human translators to check and edit).

(My real-life work at TshwaneDJe relates to language stuff and to localization and translation so I have a pretty good idea of how to go about implementing the required code changes, but I can't do actual translations as that needs a "real translator". But I am aware of the pitfalls and difficulties of localization in general too - and how much work it is to do reasonably decent translations by a translator too. Ideally would be good to have quality translations.)

I know translation is non-trivial work though and I don't have a budget to pay translators, so at this point it would need to be voluntary open contribution.

Also if anyone is interested in helping with other languages please let me know?

The official "Issue" to discuss that is: https://github.com/davidjoffe/dave_gnukem/issues/178

davidjoffe commented 1 year ago

(Technically: The current main game font doesn't support French diacritics, as it's an ancient non-Unicode raster font I did largely by hand centuries ago around the time Stone Age people were first creating ASCII, I had a look in Photoshop and concluded it would be "too painful" and not worth it to try adapt the current 8x8 font to add diacritics - BUT long story short, I found the quite nice looking open retro font that does seem to have the necessary diacritics for French - it's TTF and I was first thinking I could use my new TTF code (but that would add a new dependency, creating some maintenance work for porters & eg Debian package management so ideally I don't want to add new dependencies if I can avoid it), but then I thought I could also alternatively just pre-render into a raster font all the characters needed for French and other major Latin-alphabet-based languages and then posssibly with zero new dependencies but just some work on the coding backend for utf8 in the raster font rendering stuff and then to add support for loading translations and some UI code for selecting language we could do this, that is some fun 'weekend coding'. But anyway yes I am keen to do those coding changes to support localization, but would need human translators to do actual translations!)

jmfergeau commented 1 year ago

I've started working on the localization support in the game backend, and even grabbed some French text from Google Translate (yes I know, horrible bad translations, not valid for actual localization, it was just to test the code changes and work on the code side of things) to help test potential support in some screenshots the other day.

Sure! Would be a pleasure to help! I love the game and i love translating games i love when i can ^^ I've just cloned the localization branch. There's indeed some corrections to do! lol I'll start on that ^^