// decode an SPR number and do it. int spr_sprnum(struct spr_tree *tree, int coded_sprnum) { int tmp, sprnum; if(!coded_sprnum) return FALSE; else if(coded_sprnum>0){ // classic rooted-tree SPRs not spanning the root sprnum = coded_sprnum-1; if(sprnum > tree->lcg.m) return FALSE; if(tree->lastspr < 0) unrootmove(tree); tmp = spr(tree, tree->nodelist[ sprmap(sprnum, 0) ], tree->nodelist[ sprmap(sprnum, 1) ]); return tree->lastspr = tmp ? coded_sprnum : 0; }else{ // root moving sprnum = (-coded_sprnum)-1; int rootpos = sprnum / (tree->nodes*tree->nodes); if(rootpos >= tree->nodes) return FALSE; spr_unspr(tree); // unrootmove(tree); struct spr_node *r = tree->root, *c = tree->nodelist[rootpos]; // if(isleaf(c) || r==c) return FALSE; if(r==c) return FALSE; //ROOTMOVE ONLY if(c->parent != r) placeroot(tree, c); // don't repeat ourselves sprnum = sprnum % (tree->nodes*tree->nodes); tmp = sprnum % tree->nodes; sprnum /= tree->nodes; tmp = spr(tree, tree->nodelist[tmp], tree->nodelist[sprnum]); tree->lastspr = coded_sprnum; // root is out of place whether we succeed or not return tmp ? coded_sprnum : 0; } }
main () { FILE *fin = fopen ("sprime.in", "r"); int al; int i,j,tp; fout=fopen ("sprime.out", "w"); fscanf (fin, "%d", &al); spr(2,al-1); spr(3,al-1); spr(5,al-1); spr(7,al-1); exit (0); }
GameVars::GameVars() : mouse(new Mouse) { std::string path("../data/images/tiles/"); std::string soundpath("../data/sounds/"); std::string logotitlepath("../data/images/"); for(int i = 0; i < NUMTILES; i++) { std::shared_ptr<sf::Image> img(new sf::Image); if(!img->LoadFromFile(path + PadItoA(3, i) + ".png")) { exit(EXIT_FAILURE); } tileImages.push_back(img); std::shared_ptr<sf::Sprite> spr(new sf::Sprite(*tileImages[i])); //spr->SetImage(*tileImages[i]); tileSprites.push_back(spr); } for(int i = 0; i < NUMSOUNDS; i++) { std::shared_ptr<sf::SoundBuffer> sbp(new sf::SoundBuffer); sbp->LoadFromFile(soundpath + soundFilenames[i] + ".wav"); SoundBuffers.push_back(sbp); std::shared_ptr<sf::Sound> sp(new sf::Sound(*sbp)); Sounds.push_back(sp); } // load title and logo titleImage = std::shared_ptr<sf::Image>(new sf::Image); titleImage->LoadFromFile(logotitlepath + "title.png"); titleSprite = std::shared_ptr<sf::Sprite>(new sf::Sprite(*titleImage)); logoImage = std::shared_ptr<sf::Image>(new sf::Image); logoImage->LoadFromFile(logotitlepath + "logo.png"); logoSprite = std::shared_ptr<sf::Sprite>(new sf::Sprite(*logoImage)); }
int main(){ sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Snake"); sf::Image mapTiles; if( !mapTiles.LoadFromFile("spritesheet.png") ){ //exit } sf::Sprite spr(mapTiles); Map map( spr ); map.openFile("map/level1.map"); while( App.IsOpened() ){ sf::Event event; while( App.GetEvent(event) ){ if(event.Type == sf::Event::Closed){ App.Close(); } } App.Clear( sf::Color(0, 0, 0) ); map.render(&App); App.Display(); } return 0; }
void gra::gra_start(string poziom) { wygrana = false; zgnieciony = false; koniec_czasu = false; escape = false; ukaszony = false; system("cls"); string l_poz; l_poz = poziom.substr(poziom.size() - 1); zmien_poziom(l_poz); int levl; istringstream iss(l_poz); iss >> levl; najlepszy_czas = zwroc_osiagi("czas", levl); rozgrywany_lvl = levl; wyswietl_poziom(); thread robsy(&gra::robaczki, this); thread spr(&gra::sprawdzenie, this); thread time(&gra::czas, this); rozgrywka(); robsy.join(); spr.join(); time.join(); }
void HumanView::Render(Time delta) { // screens render comes here // fps cap to 60 does we need more??? if(delta < 1/60 * 1000 * 1000) return; window->clear(); /* render all screen elements attached to view */ ControlList::iterator controlIt; for (controlIt = controls.begin(); controlIt != controls.end(); controlIt++) { ControlStrongPtr control = (*controlIt); if(control->Visible()) { sf::RenderTexture dest; dest.create(control->Width(),control->Height()); control->Render(delta,&dest); dest.display(); sf::Sprite spr(dest.getTexture()); spr.setPosition(control->X(),control->Y()); window->draw(spr); } } window->display(); }
int spr(int num,int l){ if(!l)if(isp(num))fprintf(fout,"%d\n",num); int i; for(i=1;i<10;i+=2){ if(isp(num))spr(num*10+i,l-1); } }
int main(int argc, char** argv) { sf::RenderWindow window(sf::VideoMode(800, 600), "sfeGLI demo"); sfe::Texture tex; tex.loadFromFile("test.ktx"); sfe::Sprite spr(tex); while (window.isOpen()) { // Event processing sf::Event event; while (window.pollEvent(event)) { // Request for closing the window if (event.type == sf::Event::Closed) window.close(); } // Clear the whole window before rendering a new frame window.clear(); // Draw some graphical entities window.draw(spr); // End the current frame and display its contents on screen window.display(); } }
Projectile::Projectile(const TextureHolder& textures) : mType(AlliedBullet) { sf::Sprite spr(textures.get(Textures::Projectile)); centerOrigin(spr); setSprite(spr); setID(1); }
ObjectSettings MovingSprite::get_settings() { ObjectSettings result = MovingObject::get_settings(); ObjectOption spr(MN_FILE, _("Sprite"), &sprite_name, "sprite"); spr.select.push_back(".sprite"); result.options.push_back(spr); return result; }
Sprite* Sprites::add(int width, int height, ColorMode mode, int ncolors) { base::UniquePtr<Sprite> spr( raster::Sprite::createBasicSprite( (raster::PixelFormat)mode, width, height, ncolors)); add(spr); return spr.release(); }
void SelectionController::sumSelection(const sf::IntRect& rect, const sf::Image* image, bool add) { float min_x = std::min(rect.left, cadre.left); float min_y = std::min(rect.top, cadre.top); sf::Texture texture = *sprite_selec.getTexture(); sf::Sprite spr(texture); sprite_selec.setPosition(min_x - 1, min_y - 1); renderTexture_selec.create(std::max(rect.left + rect.width, cadre.left + cadre.width) - min_x + 2, std::max(rect.top + rect.height, cadre.top + cadre.height) - min_y + 2); if (!inverted) renderTexture_selec.clear(ident_color); else renderTexture_selec.clear(blend_color); spr.setPosition(cadre.left - min_x, cadre.top - min_y); renderTexture_selec.draw(spr, sf::BlendNone); renderTexture_selec.display(); if (image == NULL) { sf::Image img; if (add) img.create(rect.width, rect.height, blend_color); else img.create(rect.width, rect.height, ident_color); texture.loadFromImage(img); spr.setTexture(texture, true); spr.setPosition(rect.left - min_x + 1, rect.top - min_y + 1); renderTexture_selec.draw(spr, sf::BlendNone); } else { if (add) RES->getShader(nRer::update).setParameter("mode", 1.f); //Add else RES->getShader(nRer::update).setParameter("mode", 2.f); //Sub RES->getShader(nRer::update).setParameter("offset", sprite_selec.getPosition()); RES->getShader(nRer::update).setParameter("texture", renderTexture_selec.getTexture()); texture.loadFromImage(*image, sf::IntRect(sf::Vector2i(rect.left, rect.top) - VECTOR2I(LAYER->getPosition()), sf::Vector2i(rect.width, rect.height))); sf::Vector2f vect = sf::Vector2f(rect.left, rect.top); spr.setTexture(texture, true); spr.setPosition(vect - sprite_selec.getPosition()); RES->getShader(nRer::update).setParameter("brosse", texture); RES->getShader(nRer::update).setParameter("pos_brosse", vect); renderTexture_selec.draw(spr, RES->getRender(nRer::update)); } renderTexture_selec.display(); sprite_selec.setTexture(renderTexture_selec.getTexture(), true); image_selec = new sf::Image(renderTexture_selec.getTexture().copyToImage()); }
void LevelEditorPick::draw(sf::RenderWindow& window) const { sf::RectangleShape rect; sf::Sprite spr (*tex); auto texsz = sf::Vector2f(tex->getSize()); spr.setPosition(sf::Vector2f(400,300)-texsz/2.f); rect.setSize(texsz*1.125f); rect.setPosition(sf::Vector2f(400,300)-texsz*1.125f/2.f); rect.setFillColor(sf::Color(0,0,0,128)); window.draw(rect); window.draw(spr); }
int main(){ struct punkt p={1, -1}; struct punkt q={2, 3}; struct prostokat r; r.p1.x = 1; r.p1.y = 1; r.p2.x = 4; r.p2.y = 4; //r.p1.x = 18; //r.p2.y = 31; printf("%lf\n", odleglosc(p, q)); printf("%d\n", spr(r, q)); }
ObjectSettings Decal::get_settings() { ObjectSettings result = MovingObject::get_settings(); ObjectOption spr(MN_FILE, _("Sprite"), &sprite_name, "sprite"); spr.select.push_back(".png"); spr.select.push_back(".sprite"); result.options.push_back(spr); result.options.push_back( ObjectOption(MN_TEXTFIELD, _("Action"), &default_action, "action")); result.options.push_back( ObjectOption(MN_TOGGLE, _("Solid"), &solid, "solid")); return result; }
void cv::softcascade::SCascade::detect(InputArray _image, InputArray _rois, OutputArray _objects, cv::gpu::Stream& s) const { CV_Assert(fields); // only color images and precomputed integrals are supported int type = _image.type(); CV_Assert(type == CV_8UC3 || type == CV_32SC1 || (!_rois.empty())); const cv::gpu::GpuMat image = _image.getGpuMat(); if (_objects.empty()) _objects.create(1, 4096 * sizeof(Detection), CV_8UC1); cv::gpu::GpuMat rois = _rois.getGpuMat(), objects = _objects.getGpuMat(); /// roi Fields& flds = *fields; int shr = flds.shrinkage; flds.mask.create( rois.cols / shr, rois.rows / shr, rois.type()); device::shrink(rois, flds.mask); //cv::gpu::transpose(flds.genRoiTmp, flds.mask, s); if (type == CV_8UC3) { flds.update(image.rows, image.cols, flds.shrinkage); if (flds.check((float)minScale, (float)maxScale, scales)) flds.createLevels(image.rows, image.cols); flds.preprocessor->apply(image, flds.shrunk); integral(flds.shrunk, flds.hogluv, flds.integralBuffer, s); } else { if (s) s.enqueueCopy(image, flds.hogluv); else image.copyTo(flds.hogluv); } flds.detect(objects, s); if ( (flags && NMS_MASK) != NO_REJECT) { cv::gpu::GpuMat spr(objects, cv::Rect(0, 0, flds.suppressed.cols, flds.suppressed.rows)); flds.suppress(objects, s); flds.suppressed.copyTo(spr); } }
BOOL FlashSprite::StartFlash(char* lpsFlash,LONG nWidth,LONG nHeight) { // 释放数据 if (m_FlashQuad.tex) m_pHGE->Texture_Free(m_FlashQuad.tex); memset(&m_FlashQuad,0,sizeof(m_FlashQuad)); // 创建纹理 HTEXTURE hTexture = m_pHGE->Texture_Create(nWidth,nHeight); if (hTexture == NULL) return FALSE; m_nWidth = float(nWidth); m_nHeight = float(nHeight); // 获取FLASH纹理的QUAD结构 hgeSpriteEx spr(hTexture,0,0,m_nWidth,m_nHeight); spr.GetQuad(m_FlashQuad); // 创建FLASH播放器 if (m_pFlashPlayer == NULL) { m_pFlashPlayer = new FlashPlayer; if (m_pFlashPlayer == NULL) return FALSE; } char sAppPath[MAX_PATH]; if (strlen(lpsFlash)>=2&& lpsFlash[1]==':') { strcpy(sAppPath,lpsFlash); } else { GetModuleFileName(GetModuleHandle(NULL), (LPCH)sAppPath, sizeof(sAppPath)); int i; for(i = (int)strlen(sAppPath) - 1; i > 0; i--) if(sAppPath[i]=='\\') break; sAppPath[i+1]=0; strcat(sAppPath,lpsFlash); } m_pFlashPlayer->StartAnimation(sAppPath,nWidth,nHeight,NULL); m_pFlashPlayer->SetQuality(FlashPlayer::QUALITY_HIGH); m_pFlashPlayer->GotoFrame(0); return TRUE; }
void Layer::rotation() { CURSEUR->gerer(sprite); if (INPUT->again(Qt::LeftButton)) { CURSEUR->init(sprite); angle_ini = atan2(INPUT->getPosition().y - sprite.getPosition().y, INPUT->getPosition().x - sprite.getPosition().x); } if (INPUT->pressed(Qt::LeftButton)) { float angle; if (INPUT->pressed(Qt::Key_Control)) { sf::Vector2f pos_mouse = Fonction::selecPointRect(sprite.getPosition(), INPUT->getPosition()).distance; angle = atan2(pos_mouse.y, pos_mouse.x); setRotation(Fonction::radToDeg(angle)); } else { angle = atan2(INPUT->getPosition().y - sprite.getPosition().y, INPUT->getPosition().x - sprite.getPosition().x); setRotation(Fonction::radToDeg(angle - angle_ini)); } } else if (INPUT->released(Qt::LeftButton)) { float angle = sprite.getRotation(); sf::Texture text = renderTexture.getTexture(); sf::Sprite spr(text); spr.setOrigin(sprite.getOrigin()); spr.setRotation(angle); spr.setPosition(sprite.getPosition().x - sprite.getGlobalBounds().left, sprite.getPosition().y - sprite.getGlobalBounds().top); renderTexture.create(sprite.getGlobalBounds().width, sprite.getGlobalBounds().height); renderTexture.clear(sf::Color::Transparent); renderTexture.draw(spr, sf::BlendNone); renderTexture.display(); sprite.setTexture(renderTexture.getTexture(), true); UNDO->beginMacro(); update(); UNDO->push(*new LayerMoved(this, sf::Vector2f(0, 0))); UNDO->endMacro(); sprite.setOrigin(0, 0); sprite.setPosition(0, 0); sprite.setRotation(0); sf::FloatRect bounds = sprite.getGlobalBounds(); emit layerMoved(sf::Vector2f(bounds.left, bounds.top)); emit layerScaled(sf::Vector2f(bounds.width, bounds.height)); } }
void Sprite::draw( RenderTarget& target) { Vector2f viewPos = target.getView().getCenter() - Vector2f(240, 136); if(!image) return; #ifdef __WIN32__ sf::Sprite spr(*image->handle); spr.setRotation(m_rotation); spr.setPosition(m_position.x, m_position.y); spr.setScale(m_scale.x, m_scale.y); spr.setOrigin(m_origin.x, m_origin.y); sf::IntRect r(subrect.left, subrect.top, subrect.width, subrect.height); spr.setTextureRect(r); spr.move(-viewPos.x, -viewPos.y); static_cast<RenderWindow*>(&target)->handle->draw(spr); spr.move(viewPos.x, viewPos.y); #else OSL_IMAGE* img = image->handle; if(!img) return; //img->angle = this->m_rotation; img->x = this->m_position.x; img->y = this->m_position.y; //img->centerX = this->m_origin.x; //img->centerY = this->m_origin.y; //img->stretchX = (int)( ((float)img->sizeX) * m_scale.x); //img->stretchY = (int)( ((float)img->sizeY) * m_scale.y); img->x -= viewPos.x; img->y -= viewPos.y; oslDrawImage(img); img->x += viewPos.x; img->y += viewPos.y; #endif }
void CRCTestClass::testCRC() { QFETCH(QString, fileName); QFETCH(QString, correct_crc); QString spr(QDir::separator()); fileName.prepend(".." + spr + "GL_test" + spr + "files_for_test" + spr ); qDebug() << fileName; QString calculated_crc(CalculatorFunctor::checksum_test(fileName)); QCOMPARE(calculated_crc, correct_crc); }
void Layer::grand() { CURSEUR->gerer(sprite); if (INPUT->again(Qt::LeftButton)) { CURSEUR->init(sprite); posf = VECTOR2F(INPUT->getPixel()); } if (INPUT->pressed(Qt::LeftButton)) { if (INPUT->pressed(Qt::Key_Control)) { int max_size = std::max(sprite.getTextureRect().width, sprite.getTextureRect().height); sf::Vector2f pos_mouse = Fonction::selecPointRect(posf, VECTOR2F(INPUT->getPixel())).distance; setScale(sf::Vector2f(1.f + pos_mouse.x / max_size, 1.f + pos_mouse.y / max_size)); } else setScale(sf::Vector2f(1.f + (INPUT->getPixel().x - posf.x) / this->getSize().x, 1.f + (INPUT->getPixel().y - posf.y) / this->getSize().y)); } else if (INPUT->released(Qt::LeftButton)) { sf::Vector2f scale = sprite.getScale(); sf::Texture text = renderTexture.getTexture(); sf::Sprite spr(text); renderTexture.create(sprite.getGlobalBounds().width, sprite.getGlobalBounds().height); renderTexture.clear(sf::Color::Transparent); spr.setPosition(sprite.getPosition().x - sprite.getGlobalBounds().left, sprite.getPosition().y - sprite.getGlobalBounds().top); spr.setScale(scale); spr.setOrigin(sprite.getOrigin()); renderTexture.draw(spr, sf::BlendNone); renderTexture.display(); sprite.setTexture(renderTexture.getTexture(), true); UNDO->beginMacro(); update(); UNDO->push(*new LayerMoved(this, sf::Vector2f(0, 0))); UNDO->endMacro(); sprite.setOrigin(0, 0); sprite.setPosition(0, 0); sprite.setScale(1, 1); sf::FloatRect bounds = sprite.getGlobalBounds(); emit layerMoved(sf::Vector2f(bounds.left, bounds.top)); emit layerScaled(sf::Vector2f(bounds.width, bounds.height)); } }
void HeartGame::drawHeart() { sf::Sprite spr(m_hearttex); setOriginToMiddle(spr); spr.setPosition(400.f, 300.f); spr.setColor(sf::Color(m_heartcolor)); const float beatscale = 0.66f + 0.33f * (1.f - m_beatclock.getElapsedTime().asSeconds()) / 1.f; const float pointscale = calcPointScale(m_currentlevelpoints, m_rings.getMaxPoints()); spr.setScale(beatscale * pointscale, beatscale * pointscale); m_win.draw(spr); sf::Text text(std::to_string(m_points), m_font, 20u); setOriginToMiddle(text); text.setPosition(spr.getPosition()); text.move(0.f, -55.f - (text.getLocalBounds().top + text.getLocalBounds().height) / 2.f); m_win.draw(text); }
Handler<Sprite> SpriteManager::queryRawSprite(ImageFormat const format, const int width, const int height) { typedef chisa::gl::internal::WidthOrder<Sprite> SpriteOrder; auto it = std::lower_bound(this->unusedSprite_.begin(), this->unusedSprite_.end(), std::tuple<ImageFormat, int,int>(format, width, height), Sprite::CompareByTexture()); //横幅が同じ場合は、縦幅も大きいか同じであることが保証される。 //横幅が優先なので、横幅が違う場合は高さは短いかもしれない if(it == this->unusedSprite_.end() || (*it)->texture().format() != format || (*it)->texture().height() < height || (*it)->texture().width() < width) { Handler<Sprite> spr ( new Sprite(this, format, geom::IntBox(width, height)) ); spr->resize(width, height); return spr; }else{ Handler<Sprite> spr(*it); this->unusedSprite_.erase(it); spr->resize(width, height); return spr; } }
/** * \brief Create component for display player's informations. * \param p The object containing all player's information controls. */ void ptb::frame_play_story::create_player_component(player_status& p) { bear::engine::level_globals& glob = get_layer().get_level().get_globals(); p.component = new bear::gui::visual_component(); get_content().insert( p.component ); p.component->set_background_color(PTB_THEME_FACE); set_borders_down(*p.component); p.component->insert( p.energy ); p.score_text = new bear::gui::static_text(get_font()); p.score_text->set_auto_size(false); p.component->insert( p.score_text ); p.lives_text = new bear::gui::static_text(get_font()); p.lives_text->set_auto_size(false); p.component->insert( p.lives_text ); p.stone_text = new bear::gui::static_text(get_font()); p.stone_text->set_auto_size(false); p.component->insert( p.stone_text ); bear::visual::sprite spr (glob.auto_sprite("gfx/ui/status/status.png", "plee")); p.lives_picture = new bear::gui::picture(spr); p.component->insert( p.lives_picture ); spr = glob.get_image("gfx/ui/air-power.png"); p.air_power = new bear::gui::picture(spr); p.component->insert(p.air_power); spr = glob.get_image("gfx/ui/fire-power.png"); p.fire_power = new bear::gui::picture(spr); p.component->insert(p.fire_power); spr = glob.get_image("gfx/ui/water-power.png"); p.water_power = new bear::gui::picture(spr); p.component->insert(p.water_power); spr = glob.auto_sprite("gfx/stone/stone.png", "default stone"); p.stone_picture = new bear::gui::picture(spr); p.component->insert(p.stone_picture); } // frame_play_story::create_player_component()
void HeartGame::drawBrokenHeart() { sf::Sprite spr(m_brokenhearttex); setOriginToMiddle(spr); spr.setPosition(400.f, 300.f); spr.setColor(sf::Color(m_heartcolor)); m_win.draw(spr); sf::Text text(std::to_string(m_points), m_font, 20u); setOriginToMiddle(text); text.setPosition(spr.getPosition()); text.move(0.f, -55.f - (text.getLocalBounds().top + text.getLocalBounds().height) / 2.f); m_win.draw(text); text.setString("BROKEN"); text.setStyle(sf::Text::Bold); setOriginToMiddle(text); text.setPosition(spr.getPosition()); m_win.draw(text); }
int main (void) { int p, r, f, k=0; while (k==0) { stan(); p=ruch_g(); wykonanie_g(p); k=koniec(); f=0; while(f==0) { r=ruch_k(); f=spr(r); } wykonanie_k(r); k=koniec(); } stan(); printf("Koniec gry!\n\n"); getchar(); return 0; }
void SelectionController::createSelection(const sf::IntRect& rect, const sf::Image* image) { renderTexture_selec.create(rect.width + 2, rect.height + 2); renderTexture_selec.clear(ident_color); sprite_selec.setPosition(rect.left - 1, rect.top - 1); sf::Texture texture; if (image == NULL) { sf::Image img; img.create(rect.width, rect.height, blend_color); texture.loadFromImage(img); } else { texture.loadFromImage(*image, sf::IntRect(sf::Vector2i(rect.left, rect.top) - VECTOR2I(LAYER->getPosition()), sf::Vector2i(rect.width, rect.height))); } sf::Sprite spr(texture); spr.setPosition(1, 1); renderTexture_selec.draw(spr, sf::BlendNone); renderTexture_selec.display(); sprite_selec.setTexture(renderTexture_selec.getTexture(), true); image_selec = new sf::Image(renderTexture_selec.getTexture().copyToImage()); }
void Game::updateAndRender(float64 time) { auto platform = platformSDL; map->drawTiles(&camera); Frame spr(0); spr.pivot ={150,250}; //spr.drawStraight333(sin(platform->time)*45 +45, 12); Frame player(2); player.pivot = {0.5,0.5}; player.scale = 2.0; player.flags = Frame::SPRITE_FLAG_UPDATE_DEST; vec2 pos = {platform->width/2.0f, platform->height/2.0f}; vec2 dir = pos - input.mouse; player.draw(pos.x,pos.y, dir.angle()-HALFPI); camera.zoom = 1.0f + 0.5f*sin(platform->time); if(input.left){ camera.positionWorld.x --; } if(input.right){ camera.positionWorld.x ++; } if(input.up){ camera.positionWorld.y --; } if(input.down){ camera.positionWorld.y ++; } if(input.mouseB) { camera.angle += 0.1; } if(input.mouseA){ SDL_SetRenderDrawColor(getSDLRenderer(), 0, 0, 0, 255); SDL_RenderDrawLine(getSDLRenderer(), pos.x, pos.y,dir.x,dir.y ); } Text t("Some Text!!!", {0, 150, 255}); t.drawCenter(platform->width / 2, platform->height / 4, 2.0); SDL_SetRenderDrawColor(getSDLRenderer(), 255, 155, 0, 255); // apply input and update camera // update and draw map base layer // go through all entities and: // run update proc (input/thinking | animations) // apply movement // if not dynamic collidable but drawable -> draw // go through all bodies //check for dynamic collisions and solve ->dispatch event //check for static collisions and solve ->dispatch event //draw entity // draw map top layer /** * types of entities: * ---dynamic + collidable--- * player * pickups/weapons * bullets * enemies * doors * * * ---dynamic non-collidable--- * particle systems * decals/blood * * ---static collidable--- * walls/obstacles (solid) * triggers(air) * * ---static non-collidable--- * decorations * lights * * */ }
int main (int argc, char** argv) { ros::init(argc, argv, "suturo_perception"); ros::NodeHandle nh; std::string recognitionDir = ""; if(argc > 0 && strcmp(argv[1], "_") != 0) { recognitionDir = argv[1]; ROS_INFO ("Dir for 2D recognition data set by parameter: %s", recognitionDir.c_str()); } else { std::string package_path = ros::package::getPath("suturo_perception_rosnode"); stringstream ss; ss << package_path << "/data/milestone3_2d_db.yml"; recognitionDir = ss.str(); ROS_INFO ("Dir for 2D recognition data set to milestone 3 database: %s", recognitionDir.c_str()); } // get parameters std::string pointTopic; std::string colorTopic; std::string frameId; // ros strangeness strikes again. don't try to && these! if(ros::param::get("/suturo_perception/point_topic", pointTopic)) ROS_INFO("Using parameters from Parameter Server"); else { pointTopic = "/camera/depth_registered/points"; ROS_INFO("Using default parameters");} if(ros::param::get("/suturo_perception/frame_id", frameId)); else frameId = "camera_rgb_optical_frame"; if(ros::param::get("/suturo_perception/color_topic", colorTopic)) ROS_INFO("Using parameters from Parameter Server"); else { colorTopic = "/camera/rgb/image_color"; ROS_INFO("Using default parameters");} // get recognition dir ROS_INFO("PointCloud topic is: %s", pointTopic.c_str()); ROS_INFO("FrameID is: %s", frameId.c_str()); ROS_INFO("ColorTopic topic is: %s", colorTopic.c_str()); SuturoPerceptionROSNode spr(nh, pointTopic, colorTopic, frameId, recognitionDir); ROS_INFO(" _____ "); ROS_INFO(" | | "); ROS_INFO(" | | | | "); ROS_INFO(" |_____| "); ROS_INFO(" ____ ___|_|___ ____ "); ROS_INFO(" ()___) ()___) "); ROS_INFO(" // /| |\\ \\\\ "); ROS_INFO(" // / | | \\ \\\\ "); ROS_INFO(" (___) |___________| (___) "); ROS_INFO(" (___) (_______) (___) "); ROS_INFO(" (___) (___) (___) "); ROS_INFO(" (___) |_| (___) "); ROS_INFO(" (___) ___/___\\___ | | "); ROS_INFO(" | | | | | | "); ROS_INFO(" | | |___________| /___\\ "); ROS_INFO(" /___\\ ||| ||| // \\\\ "); ROS_INFO(" // \\\\ ||| ||| \\\\ // "); ROS_INFO(" \\\\ // ||| ||| \\\\ // "); ROS_INFO(" \\\\ // ()__) (__() "); ROS_INFO(" /// \\\\\\ "); ROS_INFO(" /// \\\\\\ "); ROS_INFO(" _///___ ___\\\\\\_ "); ROS_INFO(" |_______| |_______| "); ROS_INFO(" ____ __ __ ______ __ __ ___ ____ "); ROS_INFO(" / __/ / / / //_ __/ / / / / / _ \\ / __ \\ "); ROS_INFO(" _\\ \\ / /_/ / / / / /_/ / / , _// /_/ / "); ROS_INFO("/___/_ \\____/_ /_/__ \\____/ /_/|_| \\____/______ ____ ____ _ __"); ROS_INFO(" / _ \\ / __/ / _ \\ / ___/ / __/ / _ \\/_ __/ / _/ / __ \\ / |/ /"); ROS_INFO(" / ___/ / _/ / , _// /__ / _/ / ___/ / / _/ / / /_/ / / / "); ROS_INFO("/_/ /___/ /_/|_| \\___/ /___/ /_/ /_/ /___/ \\____/ /_/|_/ "); // ROS_INFO(" suturo_perception READY"); ros::MultiThreadedSpinner spinner(2); spinner.spin(); return (0); }
void sprozitev() { spr(&tnk1,1); spr(&tnk2,0); }