Forum > Games

Fairtris — a fair implementation of Classic Tetris®

<< < (2/13) > >>

Blade:

--- Quote from: furious programming on September 08, 2021, 09:21:17 pm ---
...If there is anyone here willing to fork the repository and prepare a port for Linux, FreeBSD, and macOS, I encourage you to do so. I'm not able to create them myself, because I don't know Linux and I don't have access to a device with macOS...

...If someone would like to port to other platforms, I suggest forking the repository and developing it separately...

--- End quote ---

When it comes to forking, I think it would be more interesting and something different, if someone could port it to iOS/iPhone.  In theory, it should be possible to use the SDL Library and the Free Pascal compiler.  This is an area where Free Pascal/Lazarus has very few examples, especially anything recent.

furious programming:

--- Quote from: Soner on September 15, 2021, 11:40:57 pm ---When I press help button then screen resolution change and fairtress is very small image on the top left edge. Look picture 1.
--- End quote ---

If you press the help button (i.e. F1 key) or select HELP from the main menu, the game window is minimized and the GitHub wiki opens in your browser. If video mode is active, after selecting HELP, video mode should be deactivated, resolution restored and the window minimized. It should look like the window shouldn't be visible, just a taskbar button.

The code that supports the help looks like this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TLogic.OpenHelp();begin  Sounds.PlaySound(SOUND_START);   ShellExecute(0, 'open', 'https://github.com/furious-programming/fairtris/wiki', nil, nil, SW_SHOWNORMAL);  SDL_MinimizeWindow(Window.Window);end;
The last two instructions definitely need to be swapped, though on my computer the window always minimizes and restores properly. Although instead of minimizing the window, it is better to check if video mode is active and if so, turn on windowed mode, and if not, just open help in the browser (without any window manipulation). Video and windowed mode are quite hard to master. I'll try to fix it — thanks for tests.

How does the game behave after pressing F11? Video mode turns on and off well?


--- Quote from: Blade on September 16, 2021, 12:31:38 am ---When it comes to forking, I think it would be more interesting and something different, if someone could port it to iOS/iPhone.
--- End quote ---

I can not see it. Even if technically possible, classic Tetris is too hard to play on a touchscreen. Note that, unlike modern, it doesn't support wall-kicks or sliding pieces when touch the stack. If the piece touches the stack, it's over — it sticks to it, and a new one appears at the top of the playing field. This is a clone of the console-only game, that's why today players only play it using the controllers (NES controllers and emulators on PC), and who doesn't have controller, play on a keyboard. Precise control is very important in this case, especially at levels 18+.

On the other hand, I've played modern Tetris for smartphones a couple of times and don't get it. I don't understand how anyone can play by touching the screen instead of pressing physical buttons. For me, the touch screen is not a device intended for gaming, it is useless on this topic. But that's just my opinion, I grew up on NES myself, I always played using the controllers, and as a last resort the keyboard. 8)

Soner:
F11 ist okay, It does what it is supposed to do, switching windowed mode and fullscreen.
I put SDL_MinimizeWindow above ShellExecute. Now, when I press first help button it is working normal. But when I press it again then you can see black small window on the top left edge.

Maybe you should use OpenURL instead of ShellExecute when you want to release it on other systems than Windows.

If you are a fan of classic arcade games then check out this page.

furious programming:

--- Quote from: Soner on September 16, 2021, 06:02:28 pm ---I put SDL_MinimizeWindow above ShellExecute. Now, when I press first help button it is working normal. But when I press it again then you can see black small window on the top left edge.
--- End quote ---

Currently, there is no condition in the code to check if the video mode is active, or if the window is already minimized. This code must be secured anyway so that it doesn't try to minimize twice. But the window does not have to be minimized - it is enough to deactivate the video mode, because the browser should appear above the game window anyway.

I checked this, added a condition to disable video mode instead of minimizing, but the window appears in the top left corner of the screen instead of in the middle of it (or where it was before). Once again, there is a problem with setting the size and position of the window — SDL ignores these instructions and doesn't change anything, so the window is in a corner and has the wrong size.

Handling the help with modifications should look like this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TLogic.OpenHelp();begin  Sounds.PlaySound(SOUND_START);   if Placement.VideoEnabled then    Placement.ToggleVideoMode();   ShellExecute(0, 'open', 'https://github.com/furious-programming/fairtris/wiki', nil, nil, SW_SHOWNORMAL);end;
This works as it is supposed to, which is to disable video mode and open help in the browser. But damn it doesn't want to change the size and position of the window. It doesn't want to do this even though the Placement.ToggleVideoMode method is being used for the F11 key and always works fine. And here it does half the job.

ShellExecute is the problem here — when I comment it out, everything works fine. WTF.

furious programming:
Ok, I found a temporary solution — call ShellExecute in a separate thread. In this case, the video mode deactivates correctly, the window receives the correct dimensions and position, and the browser help opens. Stupid, but it works. So not stupid.

@Soner: if you have a minute, please test the fresh sources and let me know how it works now.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version