bool is_sound_enabled() { return sound_enabled; }
bool is_audio_enabled() {
- return (device == 0 || context == 0 ? false : true);
+ return device != 0 && context != 0;
}
void update();
bool
Controller::pressed(Control control)
{
- return oldControls[control] == false && controls[control] == true;
+ return !oldControls[control] && controls[control];
}
bool
Controller::released(Control control)
{
- return oldControls[control] == true && controls[control] == false;
+ return oldControls[control] && !controls[control];
}
void
return;
}
- controls[i->second] =
- event.type == SDL_JOYBUTTONDOWN ? true : false;
+ controls[i->second] = (event.type == SDL_JOYBUTTONDOWN);
break;
}
return;
}
Control control = key_mapping->second;
- controls[control] = event.type == SDL_KEYDOWN ? true : false;
+ controls[control] = (event.type == SDL_KEYDOWN);
}
void
break;
}
- controls[control] = event.type == SDL_KEYDOWN ? true : false;
+ controls[control] = (event.type == SDL_KEYDOWN);
}
void
i->pos.y + i->size.y > (row + buttons_box.y) * buttons_size.y)
continue;
- i->draw(context, i->id == button_selected ? true : false);
+ i->draw(context, i->id == button_selected);
}
context.pop_transform();
}
//init_rand(); PAK: this call might subsume the above 3, but I'm chicken!
main_loop->run();
-
} catch(std::exception& e) {
log_fatal << "Unexpected exception: " << e.what() << std::endl;
result = 1;
* during collision detection
*/
Rect dest;
-
+
bool solid; /**< true if this object should be considered when doing collision detection */
};
Surface* time_surf = time_surface.get();
if (time_surf) {
float all_width = time_surf->get_width() + white_text->get_text_width(time_text);
- context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1);
+ context.draw_surface(time_surf, Vector((SCREEN_WIDTH - all_width)/2, BORDER_Y + 1), LAYER_FOREGROUND1);
context.draw_text(gold_text, time_text, Vector((SCREEN_WIDTH - all_width)/2 + time_surf->get_width(), BORDER_Y), LEFT_ALLIGN, LAYER_FOREGROUND1);
}
}
/* When Down is not held anymore, disable butt jump */
if(butt_jump && !controller->hold(Controller::DOWN))
butt_jump = false;
-
- // swimming
+
+ // swimming
physic.set_acceleration_y(0);
if (swimming) {
if (controller->hold(Controller::UP) || controller->hold(Controller::JUMP)) physic.set_acceleration_y(-2000);
set_group( COLGROUP_DISABLED );
on_ground = true;
grabbed = true;
-
}
void
/// Enables or disables handling of gravity.
void enable_gravity(bool gravity_enabled);
bool gravity_enabled() const;
-
+
/// Set gravity to apply to object when enabled
void set_gravity(float gravity);
-
+
/// Get gravity to apply to object when enabled
float get_gravity() const;
Surface* coin_surf = coin_surface.get();
if (coin_surf) {
- context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_FOREGROUND1);
+ context.draw_surface(coin_surf, Vector(SCREEN_WIDTH - BORDER_X - coin_surf->get_width() - gold_text->get_text_width(coins_text), BORDER_Y + 1), LAYER_FOREGROUND1);
}
context.draw_text(gold_text, coins_text, Vector(SCREEN_WIDTH - BORDER_X, BORDER_Y), RIGHT_ALLIGN, LAYER_FOREGROUND1);
writer.write_float("width", bbox.get_width());
writer.write_float("height", bbox.get_height());
writer.write_string("script", script);
- writer.write_bool("button", (triggerevent == EVENT_ACTIVATE) ? true : false);
+ writer.write_bool("button", triggerevent == EVENT_ACTIVATE);
writer.end_list("scripttrigger");
}