Ejemplo n.º 1
0
void clearControlConfig(char *name)
{
    int i;

    i = lookup(name);

    app.keyControls[i] = app.mouseControls[i] = 0;

    initControlsDisplay();
}
Ejemplo n.º 2
0
void InstructionsMenu::init()
{
	TextButton *txtBut;
	int yPos;
	
	setTitle("Controls");
	
	yPos = initControlsDisplay();

	// Init back button.
	txtBut = new TextButton();
	txtBut->setText("Back");
	txtBut->setX(txtBut->getCenteredXPos());
	txtBut->setY(yPos);
	m_buttons.push_back(txtBut);
	yPos += txtBut->getHeight() + BUTTON_SEP;
	
}
Ejemplo n.º 3
0
static void restoreDefaults(void)
{
    int i;
    cJSON *root, *controlsJSON, *node;
    char *text;

    text = readFile("data/app/"CONFIG_FILENAME);

    root = cJSON_Parse(text);

    controlsJSON = cJSON_GetObjectItem(root, "controls");
    if (controlsJSON)
    {
        node = cJSON_GetObjectItem(controlsJSON, "keys")->child;
        while (node)
        {
            i = lookup(node->string);

            app.keyControls[i] = node->valueint;

            node = node->next;
        }

        node = cJSON_GetObjectItem(controlsJSON, "mouse")->child;
        while (node)
        {
            i = lookup(node->string);

            app.mouseControls[i] = node->valueint;

            node = node->next;
        }
    }

    cJSON_Delete(root);
    free(text);

    initControlsDisplay();
}
Ejemplo n.º 4
0
void updateControlButton(char *name)
{
    app.mouseControls[lookup(name)] = app.lastButtonPressed;

    initControlsDisplay();
}
Ejemplo n.º 5
0
void updateControlKey(char *name)
{
    app.keyControls[lookup(name)] = app.lastKeyPressed;

    initControlsDisplay();
}
Ejemplo n.º 6
0
static void controls(void)
{
	initControlsDisplay();
	
	show = SHOW_CONTROLS;
}