• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Problem with Images/DrawText [iOS]

Dabz

New member
Joined
Aug 3, 2021
Messages
19
I seem to have run into a bit of trouble, basically, I started moving code over to CBX, using mojo1, then realised, mojo2 has all the render to texture shenanigans, which I need... Anyhow, when opening up after converting it, it wouldnt open in the iOS simulator, but was fine on the desktop target...

I narrowed it down to canvas.DrawText(), when that was commented out, it opened, and all my placeholder rects were as it should, everything was fine... So, I wrote a crude bitmap font class, just basically this:-


Class CBitmapString
Const FONT_WIDTH:Int = 24
Const FONT_HEIGHT:Int = 24
Field fontImage:Image[]
Method SetupFont()
fontImage = Image.LoadFrames("font24.png",24,24,,0,0)
End Method

Method DrawString(str:String, x:Int, y:Int)
Local strArr[] = str.ToChars()
For Local loop:Int = 0 To str.Length-1
Graphics.DrawImage(fontImage[strArr[loop]],loop * FONT_WIDTH,y)
Next
End Method
End

Which again, was fine on desktop, but crashing the iOS app on startup in the simulator, which pointed me to Images, so, again, I just loaded a bog standard image, tried to draw it... BOOM. I then thought is it something wrong with my code, I'm not doing anything special in there, so opened the mojotest example, and yet... If you run it as is, it doesnt work on the iOS simulator, remove the lines:-

myCanvas.DrawImage(myImage, 320, 240, 0)
myCanvas.DrawText(" ----=== Cerberus X ===----", 320, 344, 0.5, 0.5)

And, the app doesnt crash on startup and runs (Obviously minus the text and image being displayed)

Is this a known issue on iOS at all with the simulator? Anyone experienced this... Ideally I'd like to use the simulator for as much as possible to start, then get an apple dev license to run it on my device eventually, seems a waste when just shifting code over at the mo, if you know what I mean.

Oh, and before I forget, if you have the DrawText line like so...

myCanvas.DrawText("", 320, 344, 0.5, 0.5)

With nowt in the string, it runs, because, well... There's nothing to display is there! :D
 
Last edited:
mojotest runs fine here on ios with the simulator set to iPhone 12 Pro Max - iOS 14.5
It is pretty slow but I don't see any issues besides that.
1628527564516.png
 
Mmmmm, buggering hell's testicles... Pretty typical of me, I cannot just play nice.

Right, I'll reinstall xCode and CBX and give it a spin, see if that does anything, cos that's all I've got really! :D

Dabz
 
Just in case: Did you delete your build folder before trying again?
 
@Phil7 Hiya, yeah... I cleaned everything, removed the build folder, removed xCode, removed the command tools folder in Library/Developer... All that jazz, there was literally nothing left... And after reinstalling everything... Same result... Here's a video I made to show... I start with the desktop target that works, and then move on to iOS showing how it borks if DrawImage and DrawText are used, then, run it when they are both commented out...


I've also opened it up in xCode itself, and, it fails on the simulator... But... BUT... I've signed up to the developer program and built, deployed and ran it on my device that I have here, an iPhone SE (2nd Gen)... All good as gold it seems... Which is a relief, because at least I can continue on the desktop target and just have a peek on how its doing by running it through xCode to my device.

But yeah, something a miss

Dabz

P.S. Oh, yeah... Just for specs, MacMini M1 8gig Big Sur, xCode v12.5.1

EDIT: Oh, and since I've been glued to the console output of Ted all afternoon, I've noticed this:-


Installing GerberusGame.app
Running CerberusGame.app
com.yourcompany.CerberusGame: 4080

GerberusGame!!! :D lol
 
Yes, it's an intel machine. Seems we need a M1 machine ...
 
Yup, after a looooonnnng time to update my Mac mini, it runs fine too.i get some weird error messages from macos when starting the simulator manually, but it runs fine.

@Jimmy Do you run a M1 apple machine and could test this?
 
I am googling regarding something like this and for months report problems displaying images with the simulator on M1 machines. :-/
 
Well, there's loads of warnings about OpenGL being deprecated, so maybe, just on the off chance, they've removed a finer bit of detail in the simulator in regards to OpenGL that mojo2 uses and wallop... In goes your eye out, as mojo does work no worries, it was only when I changed to mojo2 that the wheels were off.

Though, hand on heart... I havent the foggiest what I'm on about, but makes sense to me! :D hehehe ;)

Dabz
 
Sorry No M1 here either. (It works fine on 1,7Ghz Intel i5, macOS 10.15.6, Xcode 11.6)

A google search floods me with ios-simulator-bugs that I think are related.

The only thing I can come to think of that you can try for yourself is to put a slight delay of couple of frames before those draw commands are issued, and see if it makes any difference at all. It's far-fetched I know but that's what I would've done, just to rule out any slow initialisations.
 
I've added a delay [5 second] at various points within onCreate, before and after setting up a canvas, right at the beginning of onCreate, and, well, still the same, infact, it seems to crash before that because the Cerberus logo is only up for a split second and then it downs tools and back to the home screen it goes, where as on other targets (desktop and HTML5), it pauses as expected on start up, and execution carries on.
 
Forgot to mention as well, I started a timer in onCreate, then wrapped the drawing code in a If millisecs() > timer+5000 block, so anything inbetween onCreate and onRender had plenty of time to initialise before I used the commands and it still failed.
 
@Dabz: I think this is infact a Simulator bug on M1 chips. Without a device, we can't test this in anyway, never mind provide a bug fix, if there is any. Goodling, brings up related topic on all kinds of boards where people don't see images on the simulator or it crashes.
 
@MikeHart

Yeah, I did sorta realise that at first Mike matey, hence why I never put it in the CBX bugs forum, but, you never know, and just really pumping as much info as I can in here so if you guys do get an M1 machine, then, at least you've got a bit of a head start on checks that's been done, like I said, no issue, I'll just use desktop or HTML5 for now and periodically run it through xCode to my iPhone to see how it goes! ;)

Its been fun so far though, cruising around all the new glitzy stuff, a lots changed since monkey mind, you's lot have been busy, only thing I can ask for if your taking recommendations is for Ted to open the xCode project it exports, like "Build & Open in xCode", that'll be handy, very lazy, but handy! :D ;) hehehe

Right, I'll leave you's to it... And thanks for looking into it, you too @Phil7 and @Jimmy

Dabz
 
taking recommendations is for Ted to open the xCode project it exports
As we concentrate on a VScode extension, TED is basically dead in development.

But you can always right click on the exported Xcode project to "open on desktop", that should do the trick.
 
Ah right, never realised... I just go into the build folder and open from there anyway, like I said, I was just being idle! ;)

Dabz
 
Back
Top Bottom