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

Native Development

Reply
Contributor
Posts: 10
Registered: ‎06-08-2012
My Device: developer
My Carrier: None

Need a little help with SDL and TCO for the playbook

Hi everybody,

this is my first time programming for the playbook (or anything similar) and so far I've managed to get SDL running (with a 'pre-configured' example, and even so I think I did something wrong).

A while ago I coded a very simple program using SDL(for windows) in which you move a character with the keyboard arrows.

I 'ported' it to NDK and it works in the playbook simulator, it even moves with the keyboard arrows.

However, I'm trying to implement the touch control (with Touch Control OVerlay), I've already made a "sdl-controls.xml" file in the 'root' folder of the project and added it as an asset in "bar-descriptor.xml",as well as the png files, but I don't know how to get SDL to use it.

 

If I import touchcontroloverlay.h into the project it generates some errors, and I don't see any functions (tco_....) in SDL to enable it.

 

So, if anyone can help I'd  appreciate it, If anything is unclear let me know and I'll try to explain it better.

 

greetings.

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Need a little help with SDL and TCO for the playbook

What are the errors?

 

Stuart

Contributor
Posts: 10
Registered: ‎06-08-2012
My Device: developer
My Carrier: None

Re: Need a little help with SDL and TCO for the playbook

When I included this file>

#include "touchcontroloverlay_priv.h"

I got the error

C:/bbndk-2.0.1/target/qnx6/usr/include/stdint.h:232: error: 'uintptr_t' is already declared in this scope

 

which I already solved, however the TCO is still not working.

 

Here's a screen cap of the simulator:

playbook screen

The background is uniform and there should be 8 'buttons'

 

Every time I start the app different butons show(sometimes none) and they shouldn't look like that, there sould be like these red ones:

buttons

I've coded the program so that when it detects a key press (which I understand TCO emulates) it moves the sprite, but as I said the 'buttons' have no effect (the keyboard does), it doesn't work  with scancode either.

 

 switch( event.key.keysym.sym )
                   {
                           case 273:
                                 y=y-5;
                                 break;

                    ...................}

 

The  xml file containing the controls is this:

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<emulation version="1">

 <key x="20" y="150" width="16" height="16" sym="273" scancode="273">
 <label x="0" y="0" width="16" height="16" image="1.png"/>
 </key>

 <key x="60" y="150" width="16" height="16" sym="274" scancode="274">
 <label x="0" y="0" width="16" height="16" image="2.png"/>
 </key>

 <key x="40" y="110" width="16" height="16" sym="276" scancode="276">
 <label x="0" y="0" width="16" height="16" image="3.png"/>
 </key>

 <key x="40" y="180" width="16" height="16" sym="275" scancode="275">
<label x="0" y="0" width="16" height="16" image="4.png" />
</key>


<key x="300" y="100" width="32" height="16" sym="115" scancode="115">
<label x="0" y="0" width="32" height="16" image="5.png"/>
</key>


<key x="300" y="180" width="32" height="16" sym="13" scancode="13">
<label x="0" y="0" width="32" height="16" image="6.png"/>
</key>


<key x="400" y="160" width="32" height="16" sym="102" scancode="100">
<label x="0" y="0" width="32" height="16" image="7.png"/>
</key>


<key x="400" y="120" width="32" height="16" sym="100" scancode="102">
<label x="0" y="0" width="32" height="16" image="8.png"/>
</key>


<key x="0" y="0" width="25" height="25" sym="48" scancode="254"/>
<key x="218" y="0" width="25" height="25" sym="292" scancode="292"/>

</emulation>

 

 

 

So, any ideas on why it doesn't work?? I really need help with this, the touch control is keeping me from advancing.

Highlighted
Retired
Posts: 54
Registered: ‎10-26-2011
My Device: Playbook
My Carrier: Rogers

Re: Need a little help with SDL and TCO for the playbook

Hi, 

 

Thanks for your input.  Please go to github and find the TouchControlOverlay project in the BlackBerry organization.  There you can log a bug against this library and continue further discussion.  Thank you. 

 

Anthony

New Developer
Posts: 30
Registered: ‎08-06-2012
My Device: PlayBook
My Carrier: Cosmote

Re: Need a little help with SDL and TCO for the playbook

I have a similar compile error (C:/bbndk-2.0.1/target/qnx6/usr/include/stdint.h:232: error: 'uintptr_t' is already declared in this scope) how did you solve it?
Contributor
Posts: 10
Registered: ‎06-08-2012
My Device: developer
My Carrier: None

Re: Need a little help with SDL and TCO for the playbook

 I didn't solve my problem at alll, but i think I solved yours. You have to modify the file C:/bbndk-2.0.1/target/qnx6/usr/include/stdint.h    and comment or delete the lines that declare uintptr_Tt, because it's already defined in sdl or somewhere else.

New Developer
Posts: 30
Registered: ‎08-06-2012
My Device: PlayBook
My Carrier: Cosmote

Re: Need a little help with SDL and TCO for the playbook

It's not a good idea to modify system's files. But I added the preprocessor flag __PLAYBOOK__ in my application also and not just the libraries (shared & static) I use and it was solved.

Thank you though