本文整理汇总了C++中lisp::Lisp::get_vector方法的典型用法代码示例。如果您正苦于以下问题:C++ Lisp::get_vector方法的具体用法?C++ Lisp::get_vector怎么用?C++ Lisp::get_vector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lisp::Lisp
的用法示例。
在下文中一共展示了Lisp::get_vector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rock
Lantern::Lantern(const lisp::Lisp& reader)
: Rock(reader, "images/objects/lantern/lantern.sprite"),
lightcolor(1.0f, 1.0f, 1.0f)
{
//get color from lisp
std::vector<float> vColor;
reader.get_vector("color", vColor);
lightcolor = Color(vColor);
lightsprite = sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite");
lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
updateColor();
}
示例2: iter
void
Sector::parse(const lisp::Lisp& sector)
{
lisp::ListIterator iter(§or);
while(iter.next()) {
const std::string& token = iter.item();
if(token == "name") {
iter.value()->get(name);
} else if(token == "gravity") {
iter.value()->get(gravity);
} else if(token == "music") {
iter.value()->get(music);
} else if(token == "spawnpoint") {
SpawnPoint* sp = new SpawnPoint(iter.lisp());
spawnpoints.push_back(sp);
} else if(token == "init-script") {
iter.value()->get(init_script);
} else if(token == "ambient-light") {
std::vector<float> vColor;
sector.get_vector( "ambient-light", vColor );
if(vColor.size() < 3) {
log_warning << "(ambient-light) requires a color as argument" << std::endl;
} else {
ambient_light = Color( vColor );
}
} else {
GameObject* object = parse_object(token, *(iter.lisp()));
if(object) {
add_object(object);
}
}
}
update_game_objects();
if(solid_tilemaps.size() < 1) log_warning << "sector '" << name << "' does not contain a solid tile layer." << std::endl;
fix_old_tiles();
if(!camera) {
log_warning << "sector '" << name << "' does not contain a camera." << std::endl;
update_game_objects();
add_object(new Camera(this, "Camera"));
}
update_game_objects();
}
示例3: if
void
Sector::parse_old_format(const lisp::Lisp& reader)
{
name = "main";
reader.get("gravity", gravity);
std::string backgroundimage;
if (reader.get("background", backgroundimage) && (backgroundimage != "")) {
if (backgroundimage == "arctis.png") backgroundimage = "arctis.jpg";
if (backgroundimage == "arctis2.jpg") backgroundimage = "arctis.jpg";
if (backgroundimage == "ocean.png") backgroundimage = "ocean.jpg";
backgroundimage = "images/background/" + backgroundimage;
if (!PHYSFS_exists(backgroundimage.c_str())) {
log_warning << "Background image \"" << backgroundimage << "\" not found. Ignoring." << std::endl;
backgroundimage = "";
}
}
float bgspeed = .5;
reader.get("bkgd_speed", bgspeed);
bgspeed /= 100;
Color bkgd_top, bkgd_bottom;
int r = 0, g = 0, b = 128;
reader.get("bkgd_red_top", r);
reader.get("bkgd_green_top", g);
reader.get("bkgd_blue_top", b);
bkgd_top.red = static_cast<float> (r) / 255.0f;
bkgd_top.green = static_cast<float> (g) / 255.0f;
bkgd_top.blue = static_cast<float> (b) / 255.0f;
reader.get("bkgd_red_bottom", r);
reader.get("bkgd_green_bottom", g);
reader.get("bkgd_blue_bottom", b);
bkgd_bottom.red = static_cast<float> (r) / 255.0f;
bkgd_bottom.green = static_cast<float> (g) / 255.0f;
bkgd_bottom.blue = static_cast<float> (b) / 255.0f;
if(backgroundimage != "") {
Background* background = new Background();
background->set_image(backgroundimage, bgspeed);
add_object(background);
} else {
Gradient* gradient = new Gradient();
gradient->set_gradient(bkgd_top, bkgd_bottom);
add_object(gradient);
}
std::string particlesystem;
reader.get("particle_system", particlesystem);
if(particlesystem == "clouds")
add_object(new CloudParticleSystem());
else if(particlesystem == "snow")
add_object(new SnowParticleSystem());
else if(particlesystem == "rain")
add_object(new RainParticleSystem());
Vector startpos(100, 170);
reader.get("start_pos_x", startpos.x);
reader.get("start_pos_y", startpos.y);
SpawnPoint* spawn = new SpawnPoint;
spawn->pos = startpos;
spawn->name = "main";
spawnpoints.push_back(spawn);
music = "chipdisko.ogg";
// skip reading music filename. It's all .ogg now, anyway
/*
reader.get("music", music);
*/
music = "music/" + music;
int width = 30, height = 15;
reader.get("width", width);
reader.get("height", height);
std::vector<unsigned int> tiles;
if(reader.get_vector("interactive-tm", tiles)
|| reader.get_vector("tilemap", tiles)) {
TileMap* tilemap = new TileMap();
tilemap->set(width, height, tiles, LAYER_TILES, true);
// replace tile id 112 (old invisible tile) with 1311 (new invisible tile)
for(size_t x=0; x < tilemap->get_width(); ++x) {
for(size_t y=0; y < tilemap->get_height(); ++y) {
const Tile* tile = tilemap->get_tile(x, y);
if(tile->getID() == 112) tilemap->change(x, y, 1311);
}
}
if (height < 19) tilemap->resize(width, 19);
add_object(tilemap);
}
if(reader.get_vector("background-tm", tiles)) {
TileMap* tilemap = new TileMap();
tilemap->set(width, height, tiles, LAYER_BACKGROUNDTILES, false);
if (height < 19) tilemap->resize(width, 19);
add_object(tilemap);
//.........这里部分代码省略.........