Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 Canvas problem

Got my keys (had to get rid of Windows 8) so installed the test on Dev Alpha

 

Does exactly as expected under 1103

 

The entire screen goes red

 

If you look at script/test.js and the HTML in it does nothing other than size the canvas then paint the thing red

 

Sometimes you need to tweak the nimbers for ww and wh

 

Also be aware that orientation changes are horrid to handle




Click the like button if you find my posts useful!
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 Canvas problem

Signed BAR (for lazy people) here

 

Its the most boring app in the world (screen goes red)

 

 




Click the like button if you find my posts useful!
Please use plain text.
Contributor
maniac31
Posts: 11
Registered: ‎11-27-2012
My Device: PlayBook 16gb
My Carrier: ATT

Re: BB10 Canvas problem

Right, as far as I know the way canvas behaves is that he number of pixels it containes is defined by the width and the height of the <canvas> element ie it cannot be changed using css. Your example works, because the canvas is so small (150x150). If you change the width and height later using css all canvas does is that it stretches. If you tried putting and image (even a simple circle) instead of the red background you'd see it stretch when you set the css with and height.

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 Canvas problem

Not tried that

 

The framework is there to allow a createElement in the div after the load

 

I'll have to expand my test a bit

 

Gimme a while




Click the like button if you find my posts useful!
Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 Canvas problem

Got it working scaled with some messing about

 

Same URLs as above but new signed and source

 

You were right - it was scaling

 

If you start it up as-is you'll need to chrome into web inspector or you'll end up with a white screen

 

Just inspect the doc then let it run and you're fine after that (I feel a new topic coming up)

 

The source is very rough and ready but defo works

 

I've now got the intended background with an 86x86 sprite at (0, 0)

 

I dunno if it's cos my Dev Alpha is in developement mode or not but it absolutely works




Click the like button if you find my posts useful!
Please use plain text.
Contributor
maniac31
Posts: 11
Registered: ‎11-27-2012
My Device: PlayBook 16gb
My Carrier: ATT

Re: BB10 Canvas problem

Not working on the simulator. But the way you do it is exaclty the same as the way I did it in my games that were all denied ( create a canvas element in js and the append it to body).

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: BB10 Canvas problem

I use ImpactJS which I know deploys perfectly

 

I've got versions of an in-development game on iOS, Droid plus (of course) PlayBook and Dev Alpha

 

I assure you that my dumb little test works fine on a real device as does our little multi-layered game

 

I think I need to remove the -d switch from my build to stop the white screen

 

I get exactly what is expected with the latest test - red background with a correcly sized sprite as I now create the canvas in the startup JQuery and place everything

 

I'll do a non-debug version in an hour (wanna watch a TV program) and see how that goes

 

Slick the damned like now (spent loads of time getting this far for you)

 

Still gotta do the Audio thing - I'm 2 days overdue on solving that one...

 

 




Click the like button if you find my posts useful!
Please use plain text.
New Contributor
a4andrew
Posts: 4
Registered: ‎12-06-2012
My Device: Dev Alpha
My Carrier: Starhub

,

Hi peardox,

 

I complied and signed yr app. It run fine in th ripple but just as I expected, it was a empty white screen on the dev alpha. Your example confirm that indeed that there was something amiss about the webworks sdk or the dev alpha about rendering a big canvas. I wonder is there any other way for the guys @ BB to help us on this as most of my app is using canvas as they are spppose to be faster.

 

andrew

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: ,

Compile it with -d then use the URL you get in Chrome

Click on something in Chrome and it suddenly starts working

I've started a new thread on white screen over this

Yep - summat is wrong with the new SDK by the look of it

The test definitely works if you kick it with debug and as you can see does exactly what you want (in a very basic way)



Click the like button if you find my posts useful!
Please use plain text.
New Contributor
a4andrew
Posts: 4
Registered: ‎12-06-2012
My Device: Dev Alpha
My Carrier: Starhub

Re: ,

Hi,

 

Do you mean that it works on the hardware? cos it is the same white screen on the dev alpha regardless of the different examples i had tried. Can you let me know when this issue is resolved? Thanks

Please use plain text.