Android App w/ PVRShell

This topic contains 2 replies, has 2 voices, and was last updated by  swizzle_stick 6 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30619

    I’m trying to write an Android demo app where the user can define what the demo should do at run-time. For example: the apps main screen has a button that says “draw triangle” and another button that says “draw circle”. When “draw triangle” is pressed, an activity that calls ‘drawTriangle.cpp’ is started, when “draw circle” is pressed, and activity that calls ‘drawCircle.cpp’ is started. Perhaps the user can choose, at run-time, which textures will be applied to which shapes. You get the idea.

    The demo is far more complex than this in real life, the point is that I would like a more dynamic demonstration rather than a static one.

    My questions are the following:

    1) Should I even be using PVRShell for this purpose?

    2) Without modifying PVRShell code, is it possible to pass arguments from the android UI (java code) to the cpp library?

    3) Can you suggest a way to cleanly implement what I am trying to accomplish?

    #35087

    Joe Davis
    Member

    The Shell does include some basic input detection functions that you can use. The Navigation3D demo makes use of this basic functionality to allow user input via on screen buttons. If you look through the source code for this demo (in particular, HandleInput(), HandleMouseClick() and HandleMouseDrag()), it should give you a good idea of how to utilise the Shell’s input mechanisms for this use case.

    As graphics is the main focus of the SDK rather than user input, you may find the functionality of this a little limited in the long run, but it should suit the case you’ve explained for now.

    #35088

    SOLVED:

    I just made a base class that extends PVRShell, and several subclasses that also extend PVRShell. In the subclasses I commented out

    PVRShell* NewDemo(){

         return new Demo();

    }

    [/CODE]

    InitApplication in the base class reads a static variable (which is set by the android UI) that tells it which class it should really load at runtime. Polymorphism happens and my app can run other PVR demos and training courses from within itself. I don’t know why it took me so long to think of this.swizzle_stick2011-08-31 17:18:47[CODE]

    PVRShell* NewDemo(){

         return new Demo();

    }

    [/CODE]

    InitApplication in the base class reads a static variable (which is set by the android UI) that tells it which class it should really load at runtime. Polymorphism happens and my app can run other PVR demos and training courses from within itself. I don’t know why it took me so long to think of this.swizzle_stick2011-08-31 17:18:47

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.