/+junk/c_sdl_joypad_ducktape

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad_ducktape

« back to all changes in this revision

Viewing changes to src/Game.c

  • Committer: Gustav Hartvigsson
  • Date: 2014-06-15 21:16:13 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140615211613-39t3ux5wos87omj0
* Switched variable names to something more consistant
* added two more files

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
#include "GameButton.h"
9
9
#include "game_utils.h"
10
10
#include "GameObject.h"
 
11
#include "JSParser.h"
11
12
 
12
13
/*
13
14
 * This file, as the rest of the project is under MIT license.
63
64
             SDL_GameControllerName (self->game_controller));
64
65
  }
65
66
  
66
 
  self->bg_colour_toggle = false;
67
 
  self->background_colour = game_color_create_color (0,0,0,255);
 
67
  self->bg_color_toggle = false;
 
68
  self->background_color = game_color_create_color (0,0,0,255);
68
69
  
69
70
  self->button = game_button_new (50,50, 50, 100);
70
71
  game_button_set_callback (self->button, "hover", game_button_my_callback_hover, NULL);
129
130
}
130
131
 
131
132
void game_draw (Game * self) {
132
 
  game_color_set_draw_color (self->renderer, self->background_colour);
 
133
  game_color_set_draw_color (self->renderer, self->background_color);
133
134
  
134
135
  SDL_RenderClear(self->renderer);
135
136
  
165
166
 
166
167
void game_button_my_callback_clicked (GameButton * self, void * data){
167
168
  Game * game = (Game *) data;
168
 
  if (game->bg_colour_toggle) {
169
 
    game->bg_colour_toggle = false;
170
 
    game->background_colour = game_color_create_color (0,0,0,255);
 
169
  if (game->bg_color_toggle) {
 
170
    game->bg_color_toggle = false;
 
171
    game->background_color = game_color_create_color (0,0,0,255);
171
172
  } else {
172
 
    game->bg_colour_toggle = true;
173
 
    game->background_colour = game_color_create_color (55,55,55,255);
 
173
    game->bg_color_toggle = true;
 
174
    game->background_color = game_color_create_color (55,55,55,255);
174
175
  }
175
176
}
176
177