Page 11 of 18
Re: Create a button's icon with a part of a big image?
Posted: Mon Aug 29, 2022 5:35 pm
by richmond62
Indeed, I did request a 64-bit Linux build.
Re: Create a button's icon with a part of a big image?
Posted: Mon Aug 29, 2022 6:16 pm
by Zax
OK !
I'm working on the next version, which includes easier cards drag an drop. I'll compile a 64-bit version for Linux.
Available very soon.
Re: Create a button's icon with a part of a big image?
Posted: Mon Aug 29, 2022 8:04 pm
by jacque
Yesterday's update still resizes the board sometimes. How are you managing the geometry? It kind of looks like it's resizing when a row gets too close to an edge?
The cards move smoothly on my iMac. I still haven't won a game.
Edit: I just won one! This game relies a whole lot on luck of the deal. I'm going to quit now while I'm feeling smug.
Edit 2: How do I get the board choices to load?
Re: Create a button's icon with a part of a big image?
Posted: Mon Aug 29, 2022 8:24 pm
by richmond62
Just as soon as I am home, in Bulgaria, I will try your 32-bit Linux build on a 32-bit laptop I inherited from my father.
Sometime on Thursday.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 6:27 am
by Zax
jacque wrote: Mon Aug 29, 2022 8:04 pm
Yesterday's update still resizes the board sometimes. How are you managing the geometry? It kind of looks like it's resizing when a row gets too close to an edge?
Board resizing is managed by script, testing the width of the larger row compared to the board's wifth - to let the player add cards to the larger row. But it can happen that the board is resized too often and this is sometimes a little bit annoying.
Congratulation for your win
jacque wrote: Mon Aug 29, 2022 8:04 pmHow do I get the board choices to load?
Sorry, I don't understand your question. Does this concern the graphical aspect of the table?
All the board backgrounds are located in the "Boards" folder, so the user can add ones.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 6:57 am
by jacque
When I choose the popdown for the boards, the only entry is "Default" which is a sort of dark gray. I have a folder with various boards that came with the zip file but I'm not sure where to put it. Right now it's in the same folder with the app, which is where the expanded zip file left it. I tried putting it into my Preferences folder but that didn't work.
Can you build this for Android? I'm usually on my Chromebook when I play games.
For the resizing. maybe all you need to do is resize the cards and not the window? I personally cringe at scripted resizing so I may be asking a lot, although the one game I did do manual resizing on is working great on my Chromebook -- it is also a card game.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 11:30 am
by Zax
The only "Default" board is an unexpected bug!
The "Boards" folder should be left as it comes, it the unzipped "Beleaguered Castle" folder (the same folder as the app). I think the bug is in my script when its define the app's folder to search in.
I use this old script found in my personal library:
Code: Select all
put getStackFolder() & "Boards" into boardsFolder
if (there is a folder boardsFolder) then ... list files
function getStackFolder
put the effective filename of stack (the mainStack of this stack) into tPath
set the itemDelimiter to slash
if the platform = "MacOS" and "standalone" is in the environment then
get ""
repeat for each item elt in tPath
if char -4 to -1 of elt <> ".app" then
put elt & slash after it
else exit repeat
end repeat
set the itemDelimiter to comma
return it
else
delete last item of tPath
set the itemDelimiter to comma
if last char of tPath <> slash then put slash after tPath
return tPath
end if
end getStackFolder
Could you please run the following little app and tell me what it says?
https://sw.ixoft.com/files/_OLD/BoardTest.zip
EDIT: put this app into the Beleaguered Castle folder.
Concerning the resizing, cards have to be resized when:
- a row is too large --> reduce cards size
- all rows are very small --> increase cards size
- user manually resizes the window (on
resizeStack)
jacque wrote: Tue Aug 30, 2022 6:57 am
Can you build this for Android? I'm usually on my Chromebook when I play games.
I can do what you want, Jacqueline

... but for Android, you will have to send me a screen capture of the Android standalone settings because I'm totally lost with all these settings - In never compiled any standalone for mobile devices.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 5:26 pm
by SWEdeAndy
I also like this game very much. It's a solitaire game that you win reasonably often.
This incarnation of it works very well! Good work, Zax!
(I restart the game instantly if it deals me 2's or multiple 3's at a the bottom of stacks - that improves my odds...

)
Like Jacque I get only Default in the Board menu. This is what your test app reports:
/Applications/Beleaguered Castle 0.05 OSX/Boards
Files in folder:
/Applications/Beleaguered Castle 0.05 OSX/Boards/Gray - Dark.jpg --> Gray - Dark
/Applications/Beleaguered Castle 0.05 OSX/Boards/Pool - Red.jpg --> Pool - Red
/Applications/Beleaguered Castle 0.05 OSX/Boards/Pool - Blue.jpg --> Pool - Blue
/Applications/Beleaguered Castle 0.05 OSX/Boards/Gray - Light.jpg --> Gray - Light
/Applications/Beleaguered Castle 0.05 OSX/Boards/Pool.jpg --> Pool
/Applications/Beleaguered Castle 0.05 OSX/Boards/Sand.jpg --> Sand
The sudden resizing of the deck is indeed a little annoying. It seems the minimum margin between top card of a stack and the edge of the window is a bit too large, maybe?
Two improvement suggestions:
1) Maybe the number of possible top card moves could be displayed, so that if it is zero, you'd know you are stuck?
It doesn't need to be too advanced - if the only move you can make is e.g. moving a 6 between two 7's, then you're still stuck (if it doesn't improve you situation), but the number of possible moves would be 1. That's ok, the game should not do all the thinking for you. But if the number of possible moves is zero, then you'd instantly know that you either have to backtrack or give up.
2) It may seem silly, but I do get a little bit disappointed when the game does nothing to acknowledge that I've won!
A little fanfare, applause and/or visual feedback (animated gif fireworks, or just a medal image or something) would be great!
For my games, this is one site where I find a lot of great free sound effects:
https://www.freesfx.co.uk/
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 7:06 pm
by jacque
I get similar results from your test app:
/Users/jgay/Desktop/Beleaguered Castle/Boards
Files in folder:
/Users/jgay/Desktop/Beleaguered Castle/Boards/Gray - Dark.jpg --> Gray - Dark
/Users/jgay/Desktop/Beleaguered Castle/Boards/Pool - Red.jpg --> Pool - Red
/Users/jgay/Desktop/Beleaguered Castle/Boards/Pool - Blue.jpg --> Pool - Blue
/Users/jgay/Desktop/Beleaguered Castle/Boards/Gray - Light.jpg --> Gray - Light
/Users/jgay/Desktop/Beleaguered Castle/Boards/Pool.jpg --> Pool
/Users/jgay/Desktop/Beleaguered Castle/Boards/Sand.jpg --> Sand
This looks okay but the boards don't load anway. However, this will fail on mobile where a much different file structure is in place. The handler you're using is pretty old, and can be replaced with the specialFolderPath() function. To work on both desktop (any OS) and mobile (either one) use specialFolderPath("resources"). This points to the files copied to the app no matter which OS is running. And even better, it points to the folder holding the mainstack during development, which means in the IDE the Boards folder (inside the main app folder) will also work.
To use this for all OS compiles, add the Boards folder to the Copy Files pane of standalone settings. SpecialFolderPath will always find them that way. Be aware that you do need to add the final slash in the returned path since specialFolderPath doesn't add one.
Basically, all you'll need is this:
Code: Select all
function getStackFolder
return specialFolderPath("resources") & slash
Edit: one more path thing for mobile when storing prefs and progress. You'll have to branch the code. On desktop you can probably continue to use whatever you're doing now since you'd have different paths for Mac and Windows anyway. On mobile, use specialFolderPath("documents") which exists on both iOS and Android. The documents folder is not visible to the user, it's inside the app's sandbox. Anything you need to write to disk should go into "documents" on mobile.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 7:31 pm
by jacque
Here's sample Android settings.
The package identifier uses a standard reverse-domain structure. I made one up for you. If you have a company name, replace "zax" with it.
I've set it to "Sign for development" which means you won't need to create a signing certificate. I also opted for a legacy app icon because it's difficult to create an adaptive icon, which is only required for the Play Store anyway. Add the path to an icon png image to the icon path; any size will work but a larger one is better. If you do not supply an icon image, Android will substitute a generic one.
After the compile you will find an .apk file. That's what you distribute to users. You can ignore or delete the .idsig file.
Fix the specialFolderPath issue I mentioned above and with fingers crossed, it will run on Android.
Edit: I screwed up the Initial Orientation when making the screenshot, I think you want Landscape.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 7:52 pm
by SWEdeAndy
And with that you've reached an amazing forum post count milestone, Jacque!

- 6666.png (24.95 KiB) Viewed 9990 times
Anyway, I wanted to add that a web deployment of Beleaguered Castle would also be very interesting to try.
Don't know if you have the necessary setup to do that, Zax, but I'd be happy to help if not.
Re: Create a button's icon with a part of a big image?
Posted: Tue Aug 30, 2022 7:53 pm
by jacque
SWEdeAndy wrote: Tue Aug 30, 2022 7:52 pm
And with that you've reached an amazing forum post count milestone, Jacque!

6666.png

Just call me The Beast.
Re: Create a button's icon with a part of a big image?
Posted: Wed Aug 31, 2022 12:04 am
by richmond62
OK, jacque, you are the Beast, BUT the Beast we love.
Re: Create a button's icon with a part of a big image?
Posted: Wed Aug 31, 2022 3:36 pm
by Zax
Dear Beast

, congratulations for all your posts, and thank you for your advices.
I would like the "Boards" folder to be visible by the user (so he eventually can add his own backgrounds). So the specialFolderPath("resources") will not work. Any idea about how to point to a visible folder inside the app folder on Android?
I really don't understand why the boards Popup Menu is empty - it works for me with standalone tested on Mac and Windows. Could you please click on the "Rules" button with option key in this new version (0.10) and tell me what you see?
You didn't cross your fingers enough...
New version available (0.10); with Linux x64 built!
Mac OS:
https://sw.ixoft.com/files/BeleagueredC ... 10_OSX.zip
Windows:
https://sw.ixoft.com/files/BeleagueredC ... 10_win.zip
Linux:
https://sw.ixoft.com/files/_OLD/Beleagu ... 10_OSX.zip
@ Andreas
I know the sudden resizing is annoying, but it's necessary. The question is: is it better to resize more heavily but less often, or more lightly but more often?
Concerning the possible moves, you can already right-click on a card to display its available moves. I prefer the user to look by himself if he's stuck.
When the game is about to be won, you now have a little animation... but still no fanfare, sorry

Maybe in a future version (thanks for the sounds lib link).
Re: Create a button's icon with a part of a big image?
Posted: Wed Aug 31, 2022 4:20 pm
by SWEdeAndy
Zax wrote: Wed Aug 31, 2022 3:36 pm
Could you please click on the "Rules" button with option key in this new version (0.10) and tell me what you see?
This is what I get, no matter if I place the folder in the Apps folder or on the desktop:
I'm running Monterey 12.5.1