/** Shows this message box * */ void RainbruRPG::OgreGui::RbMessageBox::show(void){ setTransparency(0.9f); //show(); GUI::getSingleton().moveWindowToForeGround(this); // Dialog become modal // GameEngine::getSingleton().getOgreGui()->setFocusedWidget(btnOk); }
GameStart::GameStart(){ setType("GameStart"); //dragonfly managers needed for this df::ResourceManager &resource_manager = df::ResourceManager::getInstance(); //setup GameOversprite df::Sprite *p_temp_sprite = resource_manager.getSprite("gamestart"); if (!p_temp_sprite){ df::LogManager &log_manager = df::LogManager::getInstance(); log_manager.writeLog("GameStart::GameStart(): Warning! Sprite '%s' not found", "gamestart"); } else{ setSprite(p_temp_sprite); setSpriteSlowdown(30); setTransparency('#'); } //put in center of window setLocation(df::CENTER_CENTER); //register interest registerInterest(df::KEYBOARD_EVENT); //play start music p_music = df::ResourceManager::getInstance().getMusic("start music"); playMusic(); df::WorldManager &world_manager = df::WorldManager::getInstance(); world_manager.setBoundary(df::Box(df::Position(), 250, 250)); }
ColorsSelecter::ColorsSelecter(QWidget *parent) : QLabel(parent) { lastButton = Qt::NoButton; front = TC::Black; back = TC::White; image = 0; reprintImage(); m_useAlpha = false; setPixmap(QPixmap::fromImage(image->scaled(34, 26, Qt::KeepAspectRatio/*, Qt::SmoothTransformation*/))); setFixedSize(34,26); actionWhite = new QAction(QIcon(QPixmap::fromImage(colorIcon(TC::White))), QString(), 0); actionLightGray = new QAction(QIcon(QPixmap::fromImage(colorIcon(TC::LightGray))), QString(), 0); actionDarkGray = new QAction(QIcon(QPixmap::fromImage(colorIcon(TC::DarkGray))), QString(), 0); actionBlack = new QAction(QIcon(QPixmap::fromImage(colorIcon(TC::Black))), QString(), 0); actionTransp = new QAction(QIcon(QPixmap::fromImage(colorIcon(TC::Transparency))), QString(), 0); connect(actionWhite, SIGNAL(triggered()), this, SLOT(setWhite())); connect(actionLightGray, SIGNAL(triggered()), this, SLOT(setLightGray())); connect(actionDarkGray, SIGNAL(triggered()), this, SLOT(setDarkGray())); connect(actionBlack, SIGNAL(triggered()), this, SLOT(setBlack())); connect(actionTransp, SIGNAL(triggered()), this, SLOT(setTransparency())); }
void MinimalBackground::setup(int _x, int _y, int _width, int _height) { x = _x; y = _y; width = _width; height = _height; setTransparency(35); // set default percentage }
Bitmap::Bitmap(unsigned int width, unsigned int height, bool transparent) { _bitmapData = NULL; setTransparency(transparent); createEmpty(width, height); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- CScrollContainer::CScrollContainer (const CRect &size, const CRect &containerSize) : CViewContainer (size) , containerSize (containerSize) , offset (CPoint (0, 0)) , autoDragScroll (false) , inScrolling (false) { setTransparency (true); }
void SubEntityMaterialInstance::setMaterialName (String name) { clearCopyMaterial (); mSubEntity->setMaterialName (name); initOriginalMaterial (); setTransparency (mCurrentTransparency); }
Hero::Hero(bool isClient) : isClient(isClient) { // Link to "ship" sprite. df::ResourceManager &resource_manager = df::ResourceManager::getInstance(); df::LogManager &log_manager = df::LogManager::getInstance(); df::Sprite *p_temp_sprite; if(isClient) { p_temp_sprite = resource_manager.getSprite("client"); } else { p_temp_sprite = resource_manager.getSprite("ship"); } if (!p_temp_sprite) { log_manager.writeLog("Hero::Hero(): Warning! Sprite '%s' not found", "ship"); } else { setSprite(p_temp_sprite); setSpriteSlowdown(3); // 1/3 speed animation. setTransparency(); // Transparent sprite. } // Player controls hero, so register for input events. registerInterest(df::KEYBOARD_EVENT); registerInterest(df::MOUSE_EVENT); // Need to update rate control each step. registerInterest(df::STEP_EVENT); // Set object type. setType("Hero"); // Set starting location. df::WorldManager &world_manager = df::WorldManager::getInstance(); if(isClient) { df::Position pos(7, world_manager.getBoundary().getVertical()/2+4); setPosition(pos); } else { df::Position pos(7, world_manager.getBoundary().getVertical()/2-4); setPosition(pos); } // Create reticle for firing bullets. p_reticle = new Reticle(); p_reticle->draw(); // Set attributes that control actions. move_slowdown = 2; move_countdown = move_slowdown; fire_slowdown = 30; fire_countdown = fire_slowdown; nuke_count = 1; Role &role = Role::getInstance(); if(role.isHost()) { role.registerSyncObj(this); log_manager.writeLog("Hero::Hero(): INFO! registered with %s", serialize().c_str()); } }
///===================================================================================== void CParticleSystemModel::updateOpacityInfos(void) { MINI_TIMER(PSStatsUpdateOpacityInfos); nlassert(_ParticleSystem); if (!_TransparencyStateTouched) return; nlassert(_ParticleSystem); setOpacity(_ParticleSystem->hasOpaqueObjects() || _ToolDisplayEnabled); setTransparency(_ParticleSystem->hasTransparentObjects()); _TransparencyStateTouched = false; }
void PictureShape::loadStyle(const KoXmlElement& element, KoShapeLoadingContext& context) { // Load the common parts of the style. KoTosContainer::loadStyle(element, context); KoStyleStack &styleStack = context.odfLoadingContext().styleStack(); styleStack.setTypeProperties("graphic"); // Mirroring if (styleStack.hasProperty(KoXmlNS::style, "mirror")) { QString mirrorMode = styleStack.property(KoXmlNS::style, "mirror"); QFlags<PictureShape::MirrorMode> mode = 0; // Only one of the horizontal modes if (mirrorMode.contains("horizontal-on-even")) { mode |= MirrorHorizontalOnEven; } else if (mirrorMode.contains("horizontal-on-odd")) { mode |= MirrorHorizontalOnOdd; } else if (mirrorMode.contains("horizontal")) { mode |= MirrorHorizontal; } if (mirrorMode.contains("vertical")) { mode |= MirrorVertical; } m_mirrorMode = mode; } // Color-mode (effects) if (styleStack.hasProperty(KoXmlNS::draw, "color-mode")) { QString colorMode = styleStack.property(KoXmlNS::draw, "color-mode"); if (colorMode == "greyscale") { setColorMode(Greyscale); } else if (colorMode == "mono") { setColorMode(Mono); } else if (colorMode == "watermark") { setColorMode(Watermark); } } // image opacity QString opacity(styleStack.property(KoXmlNS::draw, "image-opacity")); if (! opacity.isEmpty() && opacity.right(1) == "%") { setTransparency(1.0 - (opacity.left(opacity.length() - 1).toFloat() / 100.0)); } // clip rect m_clippingRect = parseClippingRectString(styleStack.property(KoXmlNS::fo, "clip")); }
// *************************************************************************** CVegetableBlendLayerModel::CVegetableBlendLayerModel() { VegetableManager= NULL; // The model must always be renderer in transparency pass only. setTransparency(true); setOpacity(false); // The model is of course renderable CTransform::setIsRenderable(true); }
void TIGLViewerWindow::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); bool OneOrMoreIsSelected = false; for (myScene->getContext()->InitCurrent(); myScene->getContext()->MoreCurrent (); myScene->getContext()->NextCurrent ()) { if (myScene->getContext()->IsDisplayed(myScene->getContext()->Current())) { OneOrMoreIsSelected=true; } } if (OneOrMoreIsSelected) { QAction *eraseAct; eraseAct = new QAction(tr("&Erase"), this); eraseAct->setStatusTip(tr("Erase selected components")); menu.addAction(eraseAct); connect(eraseAct, SIGNAL(triggered()), myOCC, SLOT(eraseSelected())); QAction *transparencyAct; transparencyAct = new QAction(tr("&Transparency"), this); transparencyAct->setStatusTip(tr("Component Transparency")); menu.addAction(transparencyAct); connect(transparencyAct, SIGNAL(triggered()), myOCC, SLOT(setTransparency())); QAction *wireframeAct; wireframeAct = new QAction(tr("&Wireframe"), this); wireframeAct->setStatusTip(tr("Component Wireframe")); menu.addAction(wireframeAct); connect(wireframeAct, SIGNAL(triggered()), myOCC, SLOT(setObjectsWireframe())); QAction *shadingAct; shadingAct = new QAction(tr("&Shading"), this); shadingAct->setStatusTip(tr("Component Shading")); menu.addAction(shadingAct); connect(shadingAct, SIGNAL(triggered()), myOCC, SLOT(setObjectsShading())); QAction *colorAct; colorAct = new QAction(tr("&Color"), this); colorAct->setStatusTip(tr("Component Color")); menu.addAction(colorAct); connect(colorAct, SIGNAL(triggered()), myOCC, SLOT(setObjectsColor())); QAction *materialAct; materialAct = new QAction(tr("&Material"), this); materialAct->setStatusTip(tr("Component Material")); menu.addAction(materialAct); connect(materialAct, SIGNAL(triggered()), myOCC, SLOT(setObjectsMaterial())); } TIGLViewerScopedCommand command(getConsole(), false); Q_UNUSED(command); menu.exec(event->globalPos()); }
OSGMaterialStruct::OSGMaterialStruct(const mars::interfaces::MaterialData &mat) { setColorMode(osg::Material::OFF); setAmbient(osg::Material::FRONT, toOSGVec4(mat.ambientFront)); setAmbient(osg::Material::BACK, toOSGVec4(mat.ambientBack)); setSpecular(osg::Material::FRONT, toOSGVec4(mat.specularFront)); setSpecular(osg::Material::BACK, toOSGVec4(mat.specularBack)); setDiffuse(osg::Material::FRONT, toOSGVec4(mat.diffuseFront)); setDiffuse(osg::Material::BACK, toOSGVec4(mat.diffuseBack)); setEmission(osg::Material::FRONT, toOSGVec4(mat.emissionFront)); setEmission(osg::Material::BACK, toOSGVec4(mat.emissionBack)); setShininess(osg::Material::FRONT_AND_BACK, mat.shininess); setTransparency(osg::Material::FRONT_AND_BACK, mat.transparency); }
TransparentPlugin::TransparentPlugin(unsigned base, const char *config) : Plugin(base) #ifndef WIN32 , EventReceiver(HighPriority) #endif { load_data(transparentData, &data, config); if (getTransparency() >100) setTransparency(100); #ifdef WIN32 timer = NULL; #else top = NULL; #endif setState(); }
Bitmap::Bitmap(std::string& filepath) { _bitmapData = NULL; setTransparency(true); if(LoadPNG(filepath)) { _loaded = true; } else { printf("Error: failed to load bitmap at path %s", filepath.c_str()); } }
//----------------------------------------------------------------------------- CTabView::CTabView (const CRect& size, CFrame* parent, const CRect& tabSize, CBitmap* background, TabPosition tabPosition, int32_t style) : CViewContainer (size) , numberOfChilds (0) , currentTab (-1) , tabPosition (tabPosition) , style (style) , tabSize (tabSize) , tabBitmap (0) , firstChild (0) , lastChild (0) , currentChild (0) { setBackground (background); setTransparency (true); }
void TileLogicCmp::onDamage(OnTileDamaged* event_) { if (!event_->_tile) return; if (event_->_tile != getEntity()) return; auto soundCmp = event_->_tile->GET_CMP(SoundComponent); soundCmp->playSound("resources/explode.wav"); auto spriteCmp = event_->_tile->GET_CMP(SpriteCmp); spriteCmp->getTexture()._filter = Eigen::Vector4f(0.5f, 0.0f, 0.0f, 0.2f); spriteCmp->setTransparency(0.5f); _life -= event_->_damage; event_->_tile = nullptr; }
Hero::Hero() { // Link to "ship" sprite. df::ResourceManager &resource_manager = df::ResourceManager::getInstance(); df::LogManager &log_manager = df::LogManager::getInstance(); df::Sprite *p_temp_sprite; p_temp_sprite = resource_manager.getSprite("ship"); if (!p_temp_sprite) { log_manager.writeLog("Hero::Hero(): Warning! Sprite '%s' not found", "ship"); } else { setSprite(p_temp_sprite); setSpriteSlowdown(3); // 1/3 speed animation. setTransparency(); // Transparent sprite. } // Player controls hero, so register for input events. registerInterest(df::KEYBOARD_EVENT); registerInterest(df::MOUSE_EVENT); // Need to update rate control each step. registerInterest(df::STEP_EVENT); // Set object type. setType("Hero"); // Set starting location. df::WorldManager &world_manager = df::WorldManager::getInstance(); df::Vector p(7, world_manager.getBoundary().getVertical()/2); setPosition(p); // Create reticle for firing bullets. p_reticle = new Reticle(); p_reticle->draw(); // Set attributes that control actions. move_slowdown = 2; move_countdown = move_slowdown; fire_slowdown = 30; fire_countdown = fire_slowdown; nuke_count = 1; }
TransparentPlugin::TransparentPlugin(unsigned base, const char *config) : Plugin(base) #ifndef WIN32 , EventReceiver(HighPriority) #endif { load_data(transparentData, &data, config); if (getTransparency() >100) setTransparency(100); #ifdef WIN32 timer = NULL; m_bHaveMouse = false; m_bActive = false; QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(tickMouse())); timer->start(1000); #else top = NULL; #endif setState(); }
//----------------------------------------------------------------------------- CTabView::CTabView (const CRect& size, CFrame* parent, CBitmap* tabBitmap, CBitmap* background, TabPosition tabPosition, int32_t style) : CViewContainer (size) , numberOfChilds (0) , tabPosition (tabPosition) , style (style) , tabSize (CRect (0, 0, 0, 0)) , tabBitmap (tabBitmap) , firstChild (0) , lastChild (0) , currentChild (0) { setBackground (background); if (tabBitmap) { tabBitmap->remember (); tabSize.right = tabBitmap->getWidth (); tabSize.bottom = tabBitmap->getHeight (); } setTransparency (true); }
//----------------------------------------------------------------------------- CScrollbar::CScrollbar (const CRect& size, IControlListener* listener, int32_t tag, ScrollbarDirection direction, const CRect& scrollSize) : CControl (size, listener, tag, 0) , direction (direction) , scrollSize (scrollSize) , scrollerArea (size) , stepValue (0.1f) , scrollerLength (0) , overlayStyle (false) , mouseIsInside (false) , drawer (0) , timer (0) { setTransparency (true); setWheelInc (0.05f); scrollerArea.inset (2, 2); calculateScrollerLength (); frameColor (0, 0, 0, 255); scrollerColor (0, 0, 255, 255); backgroundColor (255, 255, 255, 200); }
int main(int argc, char* argv[]) { // Change this to the wanted transparency const unsigned char opacity = 255; // Load an image with transparent parts that will define the shape of the window sf::Image backgroundImage; backgroundImage.loadFromFile("lazer.png"); // Create the window and center it on the screen sf::RenderWindow window(sf::VideoMode(backgroundImage.getSize().x, backgroundImage.getSize().y, 32), "laser", sf::Style::None); window.setPosition(sf::Vector2i((sf::VideoMode::getDesktopMode().width - backgroundImage.getSize().x) / 2, (sf::VideoMode::getDesktopMode().height - backgroundImage.getSize().y) / 2)); // These functions return false on an unsupported OS or when it is not supported on linux (e.g. display doesn't support shape extention) setShape(window.getSystemHandle(), backgroundImage); setTransparency(window.getSystemHandle(), opacity); // We will also draw the image on the window instead of just showing an empty window with the wanted shape sf::Texture backgroundTexture; sf::Sprite backgroundSprite; backgroundTexture.loadFromImage(backgroundImage); backgroundSprite.setTexture(backgroundTexture); // Main loop to display the image while the window is open (pressing the escape key to close the window) while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)) window.close(); } window.clear(sf::Color::Transparent); window.draw(backgroundSprite); window.display(); } return 0; }
SystemView::SystemView( const CRect& size, Editor* editor) : CViewContainer( size, editor->getChildFrame(), NULL ), editor_( editor ) { setMouseableArea( size ); setTransparency( false ); setWantsFocus( true ); setAutosizeFlags( kAutosizeAll ); #ifdef _RT_AUDIO CRect rcAudioOutPanel( 77, 66, 477, 270 ); CRect rcMidiInPanel( 487, 66, 687, 270 ); audioOutPanel_ = new AudioOutPanel( rcAudioOutPanel, editor_ ); addView( audioOutPanel_ ); midiInPanel_ = new MidiInPanel( rcMidiInPanel, editor_ ); addView( midiInPanel_ ); setColors(); #endif }
GameOver::GameOver(int new_winningPlayer){ df::ResourceManager &resource_manager = df::ResourceManager::getInstance(); df::LogManager &log_manager = df::LogManager::getInstance(); df::WorldManager &w_m = df::WorldManager::getInstance(); w_m.setViewFollowing(this); winningPlayer = new_winningPlayer; df::Sprite *p_temp_sprite = getGameOverSprite(); setSprite(p_temp_sprite); time_to_live = 100; setSpriteSlowdown(15); //1/3 speed animation setTransparency('#'); //transparent sprite time_to_live = p_temp_sprite->getFrameCount() * 300; setLocation(df::CENTER_CENTER); registerInterest(df::STEP_EVENT); }
GameOver::GameOver() { setType("GameOver"); // link to "message" sprite ResourceManager &resource_manager = ResourceManager::getInstance(); Sprite *p_temp_sprite = resource_manager.getSprite("gameover"); if (!p_temp_sprite) { LogManager &log_manager = LogManager::getInstance(); log_manager.writeLog("GameOver::GameOver(): Warning! Sprite 'gameover' not found"); } else { setSprite(p_temp_sprite); setSpriteSlowdown(15); setTransparency('#'); // transparent character time_to_live = p_temp_sprite->getFrameCount() * 15; } // put in center of screen setLocation(CENTER_CENTER); // register for step event registerInterest(STEP_EVENT); }
MidiInPanel::MidiInPanel( const CRect& rcSize, Editor* editor ) : CViewContainer( rcSize, editor->getChildFrame(), NULL ), editor_( editor ) { setTransparency( true ); setWantsFocus( true ); SoundDevices* devices = editor_->getDevices(); MidiPortMap& inPorts = devices->midiInInfo_; CCoord itemHeight = 18; CCoord boxHeight = min( 6*18+1, inPorts.size()*18+1 ); CRect rcLabelPanel( 5, 0, 150, 15 ); CRect rcBox( 25, 38, 185, 38+boxHeight ); lblCaption_ = new Label( rcLabelPanel, "Midi In" ); lblCaption_->font_ = fontPirulen9; addView( lblCaption_ ); gbPorts_ = new GridBox( rcBox, getFrame(), this ); gbPorts_->setSelectionStyle( GridBox::NoSel ); gbPorts_->setItemHeight( itemHeight ); gbPorts_->addColumn( 86 ); gbPorts_->addColumn( 14 ); for( UINT16 i=0; i<inPorts.size(); i++ ) { string portName = inPorts.getPortName( i ); bool checked = devices->midiInPortIsOpen( portName ); MidiBoxItem* item = new MidiBoxItem( portName, checked ); gbPorts_->addItem( item ); } setColors(); gbPorts_->layout(); addView( gbPorts_ ); }
void PictureShape::loadStyle(const KXmlElement& element, KShapeLoadingContext& context) { KShape::loadStyle(element, context); KOdfStyleStack &styleStack = context.odfLoadingContext().styleStack(); styleStack.setTypeProperties("graphic"); //FIXME: are there other applicable properties? if (styleStack.hasProperty(KOdfXmlNS::draw, "color-mode")) { QString colorMode = styleStack.property(KOdfXmlNS::draw, "color-mode"); if (colorMode == "greyscale") { setMode(Greyscale); } else if (colorMode == "mono") { setMode(Mono); } else if (colorMode == "watermark") { setMode(Watermark); } } const QString opacity(styleStack.property(KOdfXmlNS::draw, "image-opacity")); if (! opacity.isEmpty() && opacity.right(1) == "%") { setTransparency(1.0 - (opacity.left(opacity.length() - 1).toFloat() / 100.0)); } }
bool CMainMenu::OnEvent(const SEvent& event) { if (event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.Key == KEY_F9 && event.KeyInput.PressedDown == false) { video::IImage* image = MenuDevice->getVideoDriver()->createScreenShot(); if (image) { MenuDevice->getVideoDriver()->writeImageToFile(image, "screenshot_main.jpg"); image->drop(); } } else if (event.EventType == irr::EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_RMOUSE_LEFT_UP ) { core::rect<s32> r(event.MouseInput.X, event.MouseInput.Y, 0, 0); gui::IGUIContextMenu* menu = MenuDevice->getGUIEnvironment()->addContextMenu(r, 0, 45); menu->addItem(L"transparent menus", 666, transparent == false); menu->addItem(L"solid menus", 666, transparent == true); menu->addSeparator(); menu->addItem(L"Cancel"); } else if (event.EventType == EET_GUI_EVENT) { s32 id = event.GUIEvent.Caller->getID(); switch(id) { case 45: // context menu if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED) { s32 s = ((gui::IGUIContextMenu*)event.GUIEvent.Caller)->getSelectedItem(); if (s == 0 || s == 1) { transparent = !transparent; setTransparency(); } } break; case 1: if (event.GUIEvent.EventType == gui::EGET_LISTBOX_CHANGED || event.GUIEvent.EventType == gui::EGET_LISTBOX_SELECTED_AGAIN) { selected = ((gui::IGUIListBox*)event.GUIEvent.Caller)->getSelected(); //startButton->setEnabled(selected != 4); startButton->setEnabled(true); } break; case 2: if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) { MenuDevice->closeDevice(); start = true; } case 3: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) fullscreen = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; case 4: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) music = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; case 5: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) shadows = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; case 6: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) additive = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; case 7: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) vsync = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; case 8: if (event.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) aa = ((gui::IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); break; } } return false; }
bool CMainMenu::run(bool& outFullscreen, bool& outMusic, bool& outShadows, bool& outAdditive, bool& outVSync, bool& outAA, video::E_DRIVER_TYPE& outDriver) { //video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9; //video::E_DRIVER_TYPE driverType = video::EDT_OPENGL; video::E_DRIVER_TYPE driverType = video::EDT_BURNINGSVIDEO; //video::E_DRIVER_TYPE driverType = video::EDT_SOFTWARE; MenuDevice = createDevice(driverType, core::dimension2d<u32>(512, 384), 16, false, false, false, this); if (MenuDevice->getFileSystem()->existFile("irrlicht.dat")) MenuDevice->getFileSystem()->addFileArchive("irrlicht.dat"); else MenuDevice->getFileSystem()->addFileArchive("../../media/irrlicht.dat"); video::IVideoDriver* driver = MenuDevice->getVideoDriver(); scene::ISceneManager* smgr = MenuDevice->getSceneManager(); gui::IGUIEnvironment* guienv = MenuDevice->getGUIEnvironment(); core::stringw str = "Irrlicht Engine Demo v"; str += MenuDevice->getVersion(); MenuDevice->setWindowCaption(str.c_str()); // set new Skin gui::IGUISkin* newskin = guienv->createSkin(gui::EGST_BURNING_SKIN); guienv->setSkin(newskin); newskin->drop(); // load font gui::IGUIFont* font = guienv->getFont("../../media/fonthaettenschweiler.bmp"); if (font) guienv->getSkin()->setFont(font); // add images const s32 leftX = 260; // add tab control gui::IGUITabControl* tabctrl = guienv->addTabControl(core::rect<int>(leftX,10,512-10,384-10), 0, true, true); gui::IGUITab* optTab = tabctrl->addTab(L"Demo"); gui::IGUITab* aboutTab = tabctrl->addTab(L"About"); // add list box gui::IGUIListBox* box = guienv->addListBox(core::rect<int>(10,10,220,120), optTab, 1); box->addItem(L"OpenGL 1.5"); box->addItem(L"Direct3D 8.1"); box->addItem(L"Direct3D 9.0c"); box->addItem(L"Burning's Video 0.47"); box->addItem(L"Irrlicht Software Renderer 1.0"); box->setSelected(selected); // add button startButton = guienv->addButton(core::rect<int>(30,295,200,324), optTab, 2, L"Start Demo"); // add checkbox const s32 d = 50; guienv->addCheckBox(fullscreen, core::rect<int>(20,85+d,130,110+d), optTab, 3, L"Fullscreen"); guienv->addCheckBox(music, core::rect<int>(135,85+d,245,110+d), optTab, 4, L"Music & Sfx"); guienv->addCheckBox(shadows, core::rect<int>(20,110+d,135,135+d), optTab, 5, L"Realtime shadows"); guienv->addCheckBox(additive, core::rect<int>(20,135+d,230,160+d), optTab, 6, L"Old HW compatible blending"); guienv->addCheckBox(vsync, core::rect<int>(20,160+d,230,185+d), optTab, 7, L"Vertical synchronisation"); guienv->addCheckBox(aa, core::rect<int>(20,185+d,230,210+d), optTab, 8, L"Antialiasing"); // add about text const wchar_t* text2 = L"This is the tech demo of the Irrlicht engine. To start, "\ L"select a video driver which works best with your hardware and press 'Start Demo'.\n"\ L"What you currently see is displayed using the Burning Software Renderer (Thomas Alten).\n"\ L"The Irrlicht Engine was written by me, Nikolaus Gebhardt. The models, "\ L"maps and textures were placed at my disposal by B.Collins, M.Cook and J.Marton. The music was created by "\ L"M.Rohde and is played back by irrKlang.\n"\ L"For more informations, please visit the homepage of the Irrlicht engine:\nhttp://irrlicht.sourceforge.net"; guienv->addStaticText(text2, core::rect<int>(10, 10, 230, 320), true, true, aboutTab); // add md2 model scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/faerie.md2"); scene::IAnimatedMeshSceneNode* modelNode = smgr->addAnimatedMeshSceneNode(mesh); if (modelNode) { modelNode->setPosition( core::vector3df(0.f, 0.f, -5.f) ); modelNode->setMaterialTexture(0, driver->getTexture("../../media/faerie2.bmp")); modelNode->setMaterialFlag(video::EMF_LIGHTING, true); modelNode->getMaterial(0).Shininess = 50.f; modelNode->getMaterial(0).NormalizeNormals = true; modelNode->setMD2Animation(scene::EMAT_STAND); } // set ambient light (no sun light in the catacombs) smgr->setAmbientLight( video::SColorf(0.2f, 0.2f, 0.2f) ); scene::ILightSceneNode *light; scene::ISceneNodeAnimator* anim; scene::ISceneNode* bill; enum eLightParticle { LIGHT_NONE, LIGHT_GLOBAL, LIGHT_RED, LIGHT_BLUE }; core::vector3df lightDir[2] = { core::vector3df(0.f, 0.1f, 0.4f), core::vector3df(0.f, 0.1f, -0.4f), }; struct SLightParticle { eLightParticle type; u32 dir; }; const SLightParticle lightParticle[] = { //LIGHT_GLOBAL,0, {LIGHT_RED,0}, {LIGHT_BLUE,0}, {LIGHT_RED,1}, {LIGHT_BLUE,1}, {LIGHT_NONE,0} }; const SLightParticle *l = lightParticle; while ( l->type != LIGHT_NONE ) { switch ( l->type ) { case LIGHT_GLOBAL: // add illumination from the background light = smgr->addLightSceneNode(0, core::vector3df(10.f,40.f,-5.f), video::SColorf(0.2f, 0.2f, 0.2f), 90.f); break; case LIGHT_RED: // add light nearly red light = smgr->addLightSceneNode(0, core::vector3df(0,1,0), video::SColorf(0.8f, 0.f, 0.f, 0.0f), 30.0f); // attach red billboard to the light bill = smgr->addBillboardSceneNode(light, core::dimension2d<f32>(10, 10)); if ( bill ) { bill->setMaterialFlag(video::EMF_LIGHTING, false); bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); bill->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp")); } // add fly circle animator to the light anim = smgr->createFlyCircleAnimator(core::vector3df(0.f,0.f,-5.f),20.f, 0.002f, lightDir [l->dir] ); light->addAnimator(anim); anim->drop(); break; case LIGHT_BLUE: // add light nearly blue light = smgr->addLightSceneNode(0, core::vector3df(0,1,0), video::SColorf(0.f, 0.0f, 0.8f, 0.0f), 30.0f); // attach blue billboard to the light bill = smgr->addBillboardSceneNode(light, core::dimension2d<f32>(10, 10)); if (bill) { bill->setMaterialFlag(video::EMF_LIGHTING, false); bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); bill->setMaterialTexture(0, driver->getTexture("../../media/portal1.bmp")); } // add fly circle animator to the light anim = smgr->createFlyCircleAnimator(core::vector3df(0.f,0.f,-5.f),20.f, -0.002f, lightDir [l->dir], 0.5f); light->addAnimator(anim); anim->drop(); break; case LIGHT_NONE: break; } l += 1; } // create a fixed camera smgr->addCameraSceneNode(0, core::vector3df(45,0,0), core::vector3df(0,0,10)); // irrlicht logo and background // add irrlicht logo bool oldMipMapState = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false); guienv->addImage(driver->getTexture("../../media/irrlichtlogo3.png"), core::position2d<s32>(5,5)); video::ITexture* irrlichtBack = driver->getTexture("../../media/demoback.jpg"); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState); // query original skin color getOriginalSkinColor(); // set transparency setTransparency(); // draw all while(MenuDevice->run()) { if (MenuDevice->isWindowActive()) { driver->beginScene(false, true, video::SColor(0,0,0,0)); if (irrlichtBack) driver->draw2DImage(irrlichtBack, core::position2d<int>(0,0)); smgr->drawAll(); guienv->drawAll(); driver->endScene(); } } MenuDevice->drop(); outFullscreen = fullscreen; outMusic = music; outShadows = shadows; outAdditive = additive; outVSync = vsync; outAA = aa; switch(selected) { case 0: outDriver = video::EDT_OPENGL; break; case 1: outDriver = video::EDT_DIRECT3D8; break; case 2: outDriver = video::EDT_DIRECT3D9; break; case 3: outDriver = video::EDT_BURNINGSVIDEO; break; case 4: outDriver = video::EDT_SOFTWARE; break; } return start; }
bool MYDISP::setTransparency(bool fTrans, uint32_t clr) { clrTr = clr; mtds.SetTransColor(hdsDisp, clr); return setTransparency(fTrans); }