本文整理汇总了C++中lisp::Lisp类的典型用法代码示例。如果您正苦于以下问题:C++ Lisp类的具体用法?C++ Lisp怎么用?C++ Lisp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lisp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
Camera::parse(const lisp::Lisp& reader)
{
std::string modename;
reader.get("mode", modename);
if(modename == "normal") {
mode = NORMAL;
do_backscrolling = true;
reader.get("backscrolling", do_backscrolling);
} else if(modename == "autoscroll") {
mode = AUTOSCROLL;
const lisp::Lisp* pathLisp = reader.get_lisp("path");
if(pathLisp == NULL)
throw std::runtime_error("No path specified in autoscroll camera.");
autoscroll_path.reset(new Path());
autoscroll_path->read(*pathLisp);
autoscroll_walker.reset(new PathWalker(autoscroll_path.get()));
} else if(modename == "manual") {
mode = MANUAL;
} else {
std::stringstream str;
str << "invalid camera mode '" << modename << "'found in worldfile.";
throw std::runtime_error(str.str());
}
}
示例2: reset
void
PlayerStatus::read(const lisp::Lisp& lisp)
{
reset();
std::string bonusname;
if(lisp.get("bonus", bonusname)) {
if(bonusname == "none") {
bonus = NO_BONUS;
} else if(bonusname == "growup") {
bonus = GROWUP_BONUS;
} else if(bonusname == "fireflower") {
bonus = FIRE_BONUS;
} else if(bonusname == "iceflower") {
bonus = ICE_BONUS;
} else {
log_warning << "Unknown bonus '" << bonusname << "' in savefile" << std::endl;
bonus = NO_BONUS;
}
}
lisp.get("fireflowers", max_fire_bullets);
lisp.get("iceflowers", max_ice_bullets);
lisp.get("coins", coins);
lisp.get("max-score-multiplier", max_score_multiplier);
}
示例3: iter
void
JoystickConfig::read(const lisp::Lisp& joystick_lisp)
{
joystick_lisp.get("dead-zone", dead_zone);
joystick_lisp.get("jump-with-up", jump_with_up_joy);
lisp::ListIterator iter(&joystick_lisp);
while(iter.next())
{
if (iter.item() == "map")
{
int button = -1;
int axis = 0;
int hat = -1;
std::string control;
const lisp::Lisp* map = iter.lisp();
map->get("control", control);
int i = 0;
for(i = 0; Controller::controlNames[i] != 0; ++i)
{
if (control == Controller::controlNames[i])
break;
}
if (Controller::controlNames[i] == 0)
{
log_info << "Invalid control '" << control << "' in buttonmap" << std::endl;
}
else
{
if (map->get("button", button))
{
bind_joybutton(0, button, Controller::Control(i));
}
else if (map->get("axis", axis))
{
bind_joyaxis(0, axis, Controller::Control(i));
}
else if (map->get("hat", hat))
{
if (hat != SDL_HAT_UP &&
hat != SDL_HAT_DOWN &&
hat != SDL_HAT_LEFT &&
hat != SDL_HAT_RIGHT) {
log_info << "Invalid axis '" << axis << "' in axismap" << std::endl;
}
else
{
bind_joyhat(0, hat, Controller::Control(i));
}
}
}
}
}
}
示例4: BadGuy
DartTrap::DartTrap(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/darttrap/darttrap.sprite", LAYER_TILES-1), initial_delay(0), fire_delay(2), ammo(-1), state(IDLE)
{
reader.get("initial-delay", initial_delay);
reader.get("fire-delay", fire_delay);
reader.get("ammo", ammo);
countMe = false;
sound_manager->preload("sounds/dartfire.wav");
if (start_dir == AUTO) log_warning << "Setting a DartTrap's direction to AUTO is no good idea" << std::endl;
}
示例5: Sector
void
Level::load_old_format(const lisp::Lisp& reader)
{
reader.get("name", name);
reader.get("author", author);
Sector* sector = new Sector(this);
sector->parse_old_format(reader);
add_sector(sector);
}
示例6: BadGuy
Flame::Flame(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/flame/flame.sprite", LAYER_FLOATINGOBJECTS), angle(0), radius(100), speed(2)
{
reader.get("radius", radius);
reader.get("speed", speed);
bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
start_position.y + sin(angle) * radius));
countMe = false;
sound_manager->preload(SOUNDFILE);
}
示例7: mystate
WillOWisp::WillOWisp(const lisp::Lisp& reader)
: mystate(STATE_IDLE), target_sector("main"), target_spawnpoint("main"), soundSource(0)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
reader.get("sector", target_sector);
reader.get("spawnpoint", target_spawnpoint);
bbox.set_size(32, 32);
sprite = sprite_manager->create("images/creatures/willowisp/willowisp.sprite");
countMe = false;
}
示例8: runtime_error
MovingSprite::MovingSprite(const lisp::Lisp& reader, const std::string& sprite_name, int layer, CollisionGroup collision_group)
: sprite_name(sprite_name), layer(layer)
{
if (!reader.get("x", bbox.p1.x))
throw std::runtime_error("no x position set");
if (!reader.get("y", bbox.p1.y))
throw std::runtime_error("no y position set");
sprite = sprite_manager->create(sprite_name);
bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
set_group(collision_group);
}
示例9:
SnowBall::SnowBall(const lisp::Lisp& reader)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
//This is for a hidden badguy :)
fluffy = false;
reader.get("fluffy",fluffy);
bbox.set_size(31.8, 31.8);
if (fluffy) sprite = sprite_manager->create("images/creatures/fluffy/fluffy.sprite");
else sprite = sprite_manager->create("images/creatures/snowball/snowball.sprite");
set_direction = false;
}
示例10: BadGuy
Dispenser::Dispenser(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/dispenser/dispenser.sprite")
{
reader.get("cycle", cycle);
reader.get("badguy", badguy);
if (badguy == "mrrocket") {
if (start_dir == AUTO) log_warning << "Setting a Dispenser's direction to AUTO is no good idea" << std::endl;
sprite->set_action(dir == LEFT ? "working-left" : "working-right");
}
else {sprite->set_action("dropper");}
bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
countMe = false;
}
示例11:
PowerUp::PowerUp(const lisp::Lisp& lisp)
{
lisp.get("x", bbox.p1.x);
lisp.get("y", bbox.p1.y);
lisp.get("sprite", sprite_name);
lisp.get("script", script);
no_physics = false;
lisp.get("disable-physics", no_physics);
bbox.set_size(32, 32);
sprite = sprite_manager->create(sprite_name);
physic.enable_gravity(true);
set_group(COLGROUP_MOVING);
}
示例12:
Spiky::Spiky(const lisp::Lisp& reader)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/spiky/spiky.sprite");
}
示例13:
MrBomb::MrBomb(const lisp::Lisp& reader)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/mr_bomb/mr_bomb.sprite");
set_direction = false;
}
示例14:
Fish::Fish(const lisp::Lisp& reader)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/fish/fish.sprite");
physic.enable_gravity(true);
}
示例15:
SpiderMite::SpiderMite(const lisp::Lisp& reader)
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/spidermite/spidermite.sprite");
physic.enable_gravity(false);
}