[android] ImageView, NOT merged: How to staple & click them (MahJong solitaire) #1372
-
Hi, I used pygame's So I can't take pygame for my (written in java) android Mahjong solitaire app. I know I can "transcript" the game's logic to python (done it in javasript) but it is crucial to have several "layers" of images/sprites/ buttons overlapping (often hiding) the ones underneath; "layer" here is meant in a graphical sense = drawn one above the other (no "real" layering needed, no animation etc.). Are there any known ways to achieve such a "pseudo layering" with toga ?
(All game examples I found used buttons next to each other, like chess fields, never overlapping...) I'd be gratefull for any helping hint or link to working examples! |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 9 replies
-
There's a bunch of questions/themes here; I'll do my best to address them all. The ability to deploy PyGame on mobile has more to do with PyGame than briefcase. PyGame involves tight integration with system libraries; you can't just deploy macOS PyGame on Android. If someone were to port PyGame to Android/iOS, Briefcase should be able to deploy it - but that port won't be a simple task. Briefcase layouts aren't really focussed on "game" style layouts, so overlaying buttons isn't something that is well catered for. The closest thing I can think of would be to use a Canvas view; you can lay out arbitrary shapes on a canvas, and there is also click events, so you could probably mash that together into a responsive interface. However, there isn't any support for bitmaps on a canvas - only vector drawing. A web view may also be an option; web view has already been implemented cross platform. However, at that point you're not really developing a cross platform native app - you're developing a webpage with delusions of grandeur :-) However, it is an option. There is a BeeWare-related project called Yorkshire4 that includes a bitmap view; it was only implemented for Cocoa and GTK, and there's almost certainly been some bit-rot over the years - but it might be a starting point if you're interested in exploring that option. |
Beta Was this translation helpful? Give feedback.
-
Something new has come up / to my attention: These 5 different "staples" above consist of a Box() each, filled with ImageViews that contain one image. I encountered the problem that Furthermore the appended function (?) I am working on solutions but that will take some time (I'm a hobbyist,as mentioned before). |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
.
Appending shadows to tiles is routine, will be finished next; Well, thanks for comments on above issues in advance! |
Beta Was this translation helpful? Give feedback.
-
NOT really new, but a (maybe last) screenshot of my Go_Android app, taken by a real world device… I added the "risen tile" feature – otherwise the top and bottom lane of my "Castle" design would be nearly unresolvable. Recognizing "pairs" working well now, placing a "marker" around selected tiles is hard with toga.Pack; won't implement "Undo" but probably switching between designs programmatically and placing background image; as mentioned before will try to develop a kind of Carcassonne clone next – graphics are ready so far… |
Beta Was this translation helpful? Give feedback.
-
Just a practical hint/notice; I don't think this justifies a full new Discussion: When using an emulator with different resolutions/densities (for tests on several real world devices) I had some difficulties in re-setting to my "native" screen resolution; I found an ingenious hint at stackoverflow, telling me to write in Terminal:
|
Beta Was this translation helpful? Give feedback.
-
Here again ... (Click image to open new tab with 100% display in your browser.) |
Beta Was this translation helpful? Give feedback.
There's a bunch of questions/themes here; I'll do my best to address them all.
The ability to deploy PyGame on mobile has more to do with PyGame than briefcase. PyGame involves tight integration with system libraries; you can't just deploy macOS PyGame on Android. If someone were to port PyGame to Android/iOS, Briefcase should be able to deploy it - but that port won't be a simple task.
Briefcase layouts aren't really focussed on "game" style layouts, so overlaying buttons isn't something that is well catered for. The closest thing I can think of would be to use a Canvas view; you can lay out arbitrary shapes on a canvas, and there is also click events, so you could probably mash that tog…