Using QuestionPanel - TeachMeInc/MathGames-SDK GitHub Wiki


General Overview
MathGames Methods
Events
Using QuestionPanel

Instantiation

_questionPanel = new QuestionPanel (MathGames.instance);

Configuration

Before you call MathGame.instance.startSession(...);, you'll have to call the configure method on QuestionPanel to tell it where and how to draw the questions and answers.

_questionPanel.configure ({
    "question_area": someDisplayObject,
      // (REQUIRED) Specifies the area to place the question.
    "question_color": 0xRRGGBB,
      // (OPTIONAL) Color used to render the question, default black.
    "question_border": 0xRRGGBB,
      // (OPTIONAL) If provided, the question text will be outlined with
      // this color when rendered.
    "answer_buttons": [
        { "bounds": someDisplayObject,
            // (REQUIRED) The region where the answer should be rendered.
          "click_target": someDisplayObject,
            // (REQUIRED) A DisplayObject which receives click events for
            // this answer.
          "visibility_target": someDisplayObject,
            // (REQUIRED) If there are fewer than 4 answers, this object
            // has its visibility set to false for the unneeded answers.
          "color": 0xRRGGBB
            // (OPTIONAL) Color to render answers on this button, default
            // black.
        },
        { ... },
        { ... },
        { ... }
    ]
});