Beispiel #1
0
// Constructor
ModelShortcutMap::ModelShortcutMap() :
	default_shortcut_map_file(std::bind(&ModelShortcutMap::load_default_shortcut_map_file, this, std::placeholders::_1)),
	custom_shortcut_map_file (std::bind(&ModelShortcutMap::load_custom_shortcut_map_file , this, std::placeholders::_1)),
	shortcut_map(
		std::bind(&ModelShortcutMap::load_shortcut_map, this, std::placeholders::_1),
		std::bind(&ModelShortcutMap::save_shortcut_map, this, std::placeholders::_1)
	)
{
	register_property(default_shortcut_map_file);
	register_property(custom_shortcut_map_file );
	register_property(shortcut_map             );
}
Beispiel #2
0
// Constructor.
ModelMain::ModelMain() :
	DECLARE_READ_ONLY (config_file                 ),
	DECLARE_READ_WRITE(time_control                ),
	DECLARE_READ_WRITE(show_status_bar             ),
	DECLARE_READ_WRITE(reset_confirmation          ),
	DECLARE_READ_WRITE(delay_before_display_seconds),
	DECLARE_READ_WRITE(display_time_after_timeout  ),
	DECLARE_READ_WRITE(display_bronstein_extra_info),
	DECLARE_READ_WRITE(display_byo_yomi_extra_info ),
	DECLARE_READ_WRITE(keyboard_id                 ),
	DECLARE_READ_WRITE(keyboard_has_numeric_keypad ),
	DECLARE_READ_WRITE(modifier_keys               ),
	DECLARE_READ_WRITE(left_player                 ),
	DECLARE_READ_WRITE(right_player                ),
	DECLARE_READ_WRITE(show_player_names           )
{
	register_property(config_file                 );
	register_property(time_control                );
	register_property(show_status_bar             );
	register_property(reset_confirmation          );
	register_property(delay_before_display_seconds);
	register_property(display_time_after_timeout  );
	register_property(display_bronstein_extra_info);
	register_property(display_byo_yomi_extra_info );
	register_property(keyboard_id                 );
	register_property(keyboard_has_numeric_keypad );
	register_property(modifier_keys               );
	register_property(left_player                 );
	register_property(right_player                );
	register_property(show_player_names           );

	// Load the file if it exists.
	if(boost::filesystem::exists(config_file())) {
		try {
			boost::property_tree::read_xml(config_file(), _data, boost::property_tree::xml_parser::trim_whitespace);
		}
		catch(boost::property_tree::xml_parser_error &) {
			throw std::runtime_error("An error has occurred while reading the preference file.");
		}
	}

	// Set up the root node.
	if(_data.find("options")==_data.not_found()) {
		_data.put_child("options", ptree());
	}
	_root = &_data.get_child("options");
}
Beispiel #3
0
LightComponent::LightComponent() :
        m_draw_light_dummies(Property_<bool>::create("draw light dummies", false)),
        m_light_index(RangedProperty<int>::create("index", -1, -1, 256)),
        m_light_type(RangedProperty<int>::create("light type", 0, 0, 2)),
        m_enabled(Property_<bool>::create("enabled", true)),
        m_intensity(Property_<float>::create("intensity", 1.f)),
        m_radius(Property_<float>::create("radius", 1.f)),
        m_cast_shadows(Property_<bool>::create("cast shadows", false)),
        m_position_x(Property_<float>::create("position X", 0)),
        m_position_y(Property_<float>::create("position Y", 0)),
        m_position_z(Property_<float>::create("position Z", 0)),
        m_direction(Property_<glm::vec3>::create("direction", glm::vec3(1))),
        m_ambient(Property_<gl::Color>::create("ambient", gl::Color(0))),
        m_diffuse(Property_<gl::Color>::create("diffuse", gl::Color())),
        m_att_constant(RangedProperty<float>::create("attenuation, constant", 1, 0, 10)),
        m_att_quadratic(RangedProperty<float>::create("attenuation, quadratic", 0, 0, 10.f)),
        m_spot_cutoff(RangedProperty<float>::create("spot cutoff", 45.f, 0.f, 89.99f)),
        m_spot_exponent(RangedProperty<float>::create("spot exponent", 0, 0, 256.f))
{
    register_property(m_draw_light_dummies);
    register_property(m_light_index);
    register_property(m_light_type);
    register_property(m_enabled);
    register_property(m_intensity);
    register_property(m_radius);
    register_property(m_cast_shadows);
    register_property(m_position_x);
    register_property(m_position_y);
    register_property(m_position_z);
    register_property(m_direction);
    register_property(m_ambient);
    register_property(m_diffuse);
    register_property(m_att_constant);
    register_property(m_att_quadratic);
    register_property(m_spot_cutoff);
    register_property(m_spot_exponent);
    set_name("Lights");
}