private void initGUI() { GUIEnvironment gui = device.GUIEnvironment; gui.Skin.SetFont(gui.GetFont("fontlucida.png")); foreach (GUIDefaultColor c in Enum.GetValues(typeof(GUIDefaultColor))) { Color l = gui.Skin.GetColor(c); l.Alpha = 255; gui.Skin.SetColor(l, c); } Recti v = device.VideoDriver.ViewPort; GUITabControl tc = gui.AddTabControl(new Recti(20, 20, v.Width - 20, v.Height - 70)); GUITab t1 = tc.AddTab("Setup"); gui.AddStaticText("Driver", new Recti(20, 20, v.Width - 60, 40), false, false, t1); guiDriverType = gui.AddComboBox(new Recti(20, 40, v.Width - 60, 60), t1); foreach (DriverType t in Enum.GetValues(typeof(DriverType))) { if (t == DriverType.Null) { continue; } int i = guiDriverType.AddItem(t.ToString(), (int)t); if (t == driverType) { guiDriverType.SelectedIndex = i; } } gui.AddStaticText("Resolution", new Recti(20, 70, v.Width - 60, 90), false, false, t1); guiResolution = gui.AddComboBox(new Recti(20, 90, v.Width - 60, 110), t1); foreach (VideoMode m in device.VideoModeList.ModeList) { int i = guiResolution.AddItem(m.ToString()); if (m.Resolution == videoMode.Resolution && m.Depth == videoMode.Depth) { guiResolution.SelectedIndex = i; } } guiFullscreen = gui.AddCheckBox(fullscreen, new Recti(20, 130, v.Width - 60, 150), "Fullscreen", t1); GUITab t2 = tc.AddTab("About"); gui.AddStaticText(aboutText, new Recti(20, 20, v.Width - 60, 180), false, true, t2); guiButtonRun = gui.AddButton(new Recti(v.Width - 190, v.Height - 50, v.Width - 110, v.Height - 20), null, -1, "Run"); guiButtonExit = gui.AddButton(new Recti(v.Width - 100, v.Height - 50, v.Width - 20, v.Height - 20), null, -1, "Exit"); }
public MyEventReceiver(IrrlichtDevice device, SceneNode room, SceneNode earth) { device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); // store pointer to room so we can change its drawing mode this.driver = device.VideoDriver; this.room = room; this.earth = earth; GUIEnvironment env = device.GUIEnvironment; // set a nicer font GUIFont font = env.GetFont("../../media/fonthaettenschweiler.bmp"); if (font != null) { env.Skin.SetFont(font); } // add window and listbox GUIWindow window = env.AddWindow(new Recti(460, 375, 630, 470), false, "Use 'E' + 'R' to change"); this.listBox = env.AddListBox(new Recti(2, 22, 165, 88), window); this.listBox.AddItem("Diffuse"); this.listBox.AddItem("Bump mapping"); this.listBox.AddItem("Parallax mapping"); this.listBox.SelectedIndex = 1; // create problem text this.problemText = env.AddStaticText( "Your hardware or this renderer is not able to use the needed shaders for this material. Using fall back materials.", new Recti(150, 20, 470, 80)); this.problemText.OverrideColor = new Color(255, 255, 255, 100); // set start material (prefer parallax mapping if available) MaterialRenderer renderer = this.driver.GetMaterialRenderer(MaterialType.ParallaxMapSolid); if (renderer != null && renderer.Capability == 0) { this.listBox.SelectedIndex = 2; } // set the material which is selected in the listbox setMaterial(); }
static void Main() { DriverType?driverType = AskForDriver(); if (!driverType.HasValue) { return; } IrrlichtDevice device = IrrlichtDevice.CreateDevice(driverType.Value, new Dimension2Di(640, 480)); if (device == null) { return; } VideoDriver driver = device.VideoDriver; SceneManager smgr = device.SceneManager; GUIEnvironment env = device.GUIEnvironment; // load and display animated fairy mesh AnimatedMeshSceneNode fairy = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("../../media/faerie.md2")); if (fairy != null) { fairy.SetMaterialTexture(0, driver.GetTexture("../../media/faerie2.bmp")); // set diffuse texture fairy.SetMaterialFlag(MaterialFlag.Lighting, true); // enable dynamic lighting fairy.GetMaterial(0).Shininess = 20.0f; // set size of specular highlights fairy.Position = new Vector3Df(-10, 0, -100); fairy.SetMD2Animation(AnimationTypeMD2.Stand); } // add white light smgr.AddLightSceneNode(null, new Vector3Df(-15, 5, -105), new Colorf(1, 1, 1)); // set ambient light smgr.AmbientLight = new Colorf(0.25f, 0.25f, 0.25f); // add fps camera CameraSceneNode fpsCamera = smgr.AddCameraSceneNodeFPS(); fpsCamera.Position = new Vector3Df(-50, 50, -150); // disable mouse cursor device.CursorControl.Visible = false; // create test cube SceneNode test = smgr.AddCubeSceneNode(60); // let the cube rotate and set some light settings SceneNodeAnimator anim = smgr.CreateRotationAnimator(new Vector3Df(0.3f, 0.3f, 0)); test.Position = new Vector3Df(-100, 0, -100); test.SetMaterialFlag(MaterialFlag.Lighting, false); // disable dynamic lighting test.AddAnimator(anim); anim.Drop(); // create render target Texture rt = null; CameraSceneNode fixedCam = null; if (driver.QueryFeature(VideoDriverFeature.RenderToTarget)) { rt = driver.AddRenderTargetTexture(new Dimension2Di(256), "RTT1"); test.SetMaterialTexture(0, rt); // set material of cube to render target // add fixed camera fixedCam = smgr.AddCameraSceneNode(null, new Vector3Df(10, 10, -80), new Vector3Df(-10, 10, -100)); } else { // create problem text GUIFont font = env.GetFont("../../media/fonthaettenschweiler.bmp"); if (font != null) { env.Skin.SetFont(font); } GUIStaticText text = env.AddStaticText( "Your hardware or this renderer is not able to use the " + "render to texture feature. RTT Disabled.", new Recti(150, 20, 470, 60)); text.OverrideColor = new Color(255, 255, 255, 100); } int lastFPS = -1; while (device.Run()) { if (device.WindowActive) { driver.BeginScene(ClearBufferFlag.All, new Color(0)); if (rt != null) { // draw scene into render target // set render target texture driver.SetRenderTarget(rt, ClearBufferFlag.All, new Color(0, 0, 255)); // make cube invisible and set fixed camera as active camera test.Visible = false; smgr.ActiveCamera = fixedCam; // draw whole scene into render buffer smgr.DrawAll(); // set back old render target // The buffer might have been distorted, so clear it driver.SetRenderTarget(null, ClearBufferFlag.All, new Color(0)); // make the cube visible and set the user controlled camera as active one test.Visible = true; smgr.ActiveCamera = fpsCamera; } // draw scene normally smgr.DrawAll(); env.DrawAll(); driver.EndScene(); // display frames per second in window title int fps = driver.FPS; if (lastFPS != fps) { device.SetWindowCaption(String.Format( "Render to Texture and Specular Highlights example - Irrlicht Engine [{0}] fps: {1}", driver.Name, fps)); lastFPS = fps; } } } device.Drop(); }
static void Main(string[] args) { DriverType?driverType = AskForDriver(); if (!driverType.HasValue) { return; } device = IrrlichtDevice.CreateDevice(driverType.Value, new Dimension2Di(800, 600), 16); if (device == null) { return; } device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); device.SetWindowResizable(true); device.SetWindowCaption("Irrlicht Engine - Loading..."); VideoDriver driver = device.VideoDriver; GUIEnvironment env = device.GUIEnvironment; SceneManager smgr = device.SceneManager; smgr.Attributes.SetValue(SceneParameters.COLLADA_CreateSceneInstances, true); driver.SetTextureCreationFlag(TextureCreationFlag.Always32Bit, true); smgr.AddLightSceneNode(null, new Vector3Df(200), new Colorf(1.0f, 1.0f, 1.0f), 2000); smgr.AmbientLight = new Colorf(0.3f, 0.3f, 0.3f); // add our media directory as "search path" device.FileSystem.AddFileArchive("../../media/"); // read configuration from xml file // (we use .NET way to do this, since Lime doesn't support native Irrlicht' xml reader) XmlDocument xml = new XmlDocument(); xml.Load("../../media/config.xml"); startUpModelFile = xml.DocumentElement["startUpModel"].Attributes["file"].Value; caption = xml.DocumentElement["messageText"].Attributes["caption"].Value; messageText = xml.DocumentElement["messageText"].InnerText; if (args.Length > 0) { startUpModelFile = args[0]; } // set a nicer font GUIFont font = env.GetFont("fonthaettenschweiler.bmp"); if (font != null) { env.Skin.SetFont(font); } // load the irrlicht engine logo GUIImage img = env.AddImage( driver.GetTexture("irrlichtlogoalpha2.tga"), new Vector2Di(10, driver.ScreenSize.Height - 128)); img.ID = (int)guiID.Logo; // lock the logo's edges to the bottom left corner of the screen img.SetAlignment(GUIAlignment.UpperLeft, GUIAlignment.UpperLeft, GUIAlignment.LowerRight, GUIAlignment.LowerRight); // create menu GUIContextMenu menu = env.AddMenu(); menu.AddItem("File", -1, true, true); menu.AddItem("View", -1, true, true); menu.AddItem("Camera", -1, true, true); menu.AddItem("Help", -1, true, true); GUIContextMenu submenu; submenu = menu.GetSubMenu(0); submenu.AddItem("Open Model File & Texture...", (int)guiID.OpenModel); submenu.AddItem("Set Model Archive...", (int)guiID.SetModelArchive); submenu.AddItem("Load as Octree", (int)guiID.LoadAsOctree); submenu.AddSeparator(); submenu.AddItem("Quit", (int)guiID.Quit); submenu = menu.GetSubMenu(1); submenu.AddItem("sky box visible", (int)guiID.SkyBoxVisible, true, false, true); submenu.AddItem("toggle model debug information", (int)guiID.ToggleDebugInfo, true, true); submenu.AddItem("model material", -1, true, true); submenu = submenu.GetSubMenu(1); submenu.AddItem("Off", (int)guiID.DebugOff); submenu.AddItem("Bounding Box", (int)guiID.DebugBoundingBox); submenu.AddItem("Normals", (int)guiID.DebugNormals); submenu.AddItem("Skeleton", (int)guiID.DebugSkeleton); submenu.AddItem("Wire overlay", (int)guiID.DebugWireOverlay); submenu.AddItem("Half-Transparent", (int)guiID.DebugHalfTransparent); submenu.AddItem("Buffers bounding boxes", (int)guiID.DebugBuffersBoundingBoxes); submenu.AddItem("All", (int)guiID.DebugAll); submenu = menu.GetSubMenu(1).GetSubMenu(2); submenu.AddItem("Solid", (int)guiID.ModelMaterialSolid); submenu.AddItem("Transparent", (int)guiID.ModelMaterialTransparent); submenu.AddItem("Reflection", (int)guiID.ModelMaterialReflection); submenu = menu.GetSubMenu(2); submenu.AddItem("Maya Style", (int)guiID.CameraMaya); submenu.AddItem("First Person", (int)guiID.CameraFirstPerson); submenu = menu.GetSubMenu(3); submenu.AddItem("About", (int)guiID.About); // create toolbar GUIToolBar bar = env.AddToolBar(); Texture image = driver.GetTexture("open.png"); bar.AddButton((int)guiID.ButtonOpenModel, null, "Open a model", image, null, false, true); image = driver.GetTexture("tools.png"); bar.AddButton((int)guiID.ButtonShowToolbox, null, "Open Toolset", image, null, false, true); image = driver.GetTexture("zip.png"); bar.AddButton((int)guiID.ButtonSelectArchive, null, "Set Model Archive", image, null, false, true); image = driver.GetTexture("help.png"); bar.AddButton((int)guiID.ButtonShowAbout, null, "Open Help", image, null, false, true); // create a combobox with some senseless texts GUIComboBox box = env.AddComboBox(new Recti(250, 4, 350, 23), bar, (int)guiID.TextureFilter); box.AddItem("No filtering"); box.AddItem("Bilinear"); box.AddItem("Trilinear"); box.AddItem("Anisotropic"); box.AddItem("Isotropic"); // disable alpha setSkinTransparency(255, env.Skin); // add a tabcontrol createToolBox(); // create fps text GUIStaticText fpstext = env.AddStaticText("", new Recti(400, 4, 570, 23), true, false, bar); GUIStaticText postext = env.AddStaticText("", new Recti(10, 50, 470, 80), false, false, null, (int)guiID.PositionText); postext.Visible = false; // show about message box and load default model if (args.Length == 0) { showAboutText(); } loadModel(startUpModelFile); // add skybox skybox = smgr.AddSkyBoxSceneNode( "irrlicht2_up.jpg", "irrlicht2_dn.jpg", "irrlicht2_lf.jpg", "irrlicht2_rt.jpg", "irrlicht2_ft.jpg", "irrlicht2_bk.jpg"); // add a camera scene node camera[0] = smgr.AddCameraSceneNodeMaya(); camera[0].FarValue = 20000; // Maya cameras reposition themselves relative to their target, // so target the location where the mesh scene node is placed. camera[0].Target = new Vector3Df(0, 30, 0); camera[1] = smgr.AddCameraSceneNodeFPS(); camera[1].FarValue = 20000; camera[1].Position = new Vector3Df(0, 0, -70); camera[1].Target = new Vector3Df(0, 30, 0); setActiveCamera(camera[0]); // set window caption caption = string.Format("{0} - [{1}]", caption, driver.Name); device.SetWindowCaption(caption); // remember state so we notice when the window does lose the focus bool hasFocus = device.WindowFocused; // draw everything while (device.Run() && driver != null) { // Catch focus changes (workaround until Irrlicht has events for this) bool focused = device.WindowFocused; if (hasFocus && !focused) { onKillFocus(); } hasFocus = focused; if (device.WindowActive) { driver.BeginScene(ClearBufferFlag.All, new Color(50, 50, 50)); smgr.DrawAll(); env.DrawAll(); driver.EndScene(); string str = string.Format("FPS: {0} Tris: {1}", driver.FPS, driver.PrimitiveCountDrawn); fpstext.Text = str; CameraSceneNode cam = device.SceneManager.ActiveCamera; str = string.Format("Pos: {0} Tgt: {1}", cam.Position, cam.Target); postext.Text = str; } else { device.Yield(); } } device.Drop(); }
static void Main() { DriverType?driverType = AskForDriver(); if (!driverType.HasValue) { return; } IrrlichtDevice device = IrrlichtDevice.CreateDevice(driverType.Value, new Dimension2Di(640, 480)); if (device == null) { return; } VideoDriver driver = device.VideoDriver; SceneManager smgr = device.SceneManager; GUIEnvironment env = device.GUIEnvironment; driver.SetTextureCreationFlag(TextureCreationFlag.Always32Bit, true); // add irrlicht logo env.AddImage(driver.GetTexture("../../media/irrlichtlogoalpha2.tga"), new Vector2Di(10)); // set gui font env.Skin.SetFont(env.GetFont("../../media/fontlucida.png")); // add some help text env.AddStaticText( "Press 'W' to change wireframe mode\nPress 'D' to toggle detail map\nPress 'S' to toggle skybox/skydome", new Recti(10, 421, 250, 475), true, true, null, -1, true); // add camera CameraSceneNode camera = smgr.AddCameraSceneNodeFPS(null, 100.0f, 1.2f); camera.Position = new Vector3Df(2700 * 2, 255 * 2, 2600 * 2); camera.Target = new Vector3Df(2397 * 2, 343 * 2, 2700 * 2); camera.FarValue = 42000.0f; // disable mouse cursor device.CursorControl.Visible = false; // add terrain scene node TerrainSceneNode terrain = smgr.AddTerrainSceneNode( "../../media/terrain-heightmap.bmp", // heightmap null, // parent node -1, // node id new Vector3Df(), // position new Vector3Df(), // rotation new Vector3Df(40, 4.4f, 40), // scale new Color(255, 255, 255), // vertex color 5, // max LOD TerrainPatchSize._17, // patch size 4); // smooth factor terrain.SetMaterialFlag(MaterialFlag.Lighting, false); terrain.SetMaterialTexture(0, driver.GetTexture("../../media/terrain-texture.jpg")); terrain.SetMaterialTexture(1, driver.GetTexture("../../media/detailmap3.jpg")); terrain.SetMaterialType(MaterialType.DetailMap); terrain.ScaleTexture(1, 20); // create triangle selector for the terrain TriangleSelector selector = smgr.CreateTerrainTriangleSelector(terrain, 0); terrain.TriangleSelector = selector; // create collision response animator and attach it to the camera SceneNodeAnimator anim = smgr.CreateCollisionResponseAnimator( selector, camera, new Vector3Df(60, 100, 60), new Vector3Df(0, 0, 0), new Vector3Df(0, 50, 0)); selector.Drop(); camera.AddAnimator(anim); anim.Drop(); // create skybox and skydome driver.SetTextureCreationFlag(TextureCreationFlag.CreateMipMaps, false); SceneNode skybox = smgr.AddSkyBoxSceneNode( "../../media/irrlicht2_up.jpg", "../../media/irrlicht2_dn.jpg", "../../media/irrlicht2_lf.jpg", "../../media/irrlicht2_rt.jpg", "../../media/irrlicht2_ft.jpg", "../../media/irrlicht2_bk.jpg"); SceneNode skydome = smgr.AddSkyDomeSceneNode(driver.GetTexture("../../media/skydome.jpg"), 16, 8, 0.95f, 2); driver.SetTextureCreationFlag(TextureCreationFlag.CreateMipMaps, true); // create event receiver new MyEventReceiver(device, terrain, skybox, skydome); int lastFPS = -1; while (device.Run()) { if (device.WindowActive) { driver.BeginScene(ClearBufferFlag.All, new Color(0)); smgr.DrawAll(); env.DrawAll(); driver.EndScene(); // display frames per second in window title int fps = driver.FPS; if (lastFPS != fps) { // also print terrain height of current camera position // we can use camera position because terrain is located at coordinate origin device.SetWindowCaption(String.Format( "Terrain rendering example - Irrlicht Engine [{0}] fps: {1} Height: {2}", driver.Name, fps, terrain.GetHeight(camera.AbsolutePosition.X, camera.AbsolutePosition.Z))); lastFPS = fps; } } } device.Drop(); }
/// <summary> /// The irrlicht thread for rendering. /// </summary> private void StartIrr() { #if DEBUG try #endif { float DEGREES_TO_RADIANS = (float)(Math.PI / 180.0); //Setup IrrlichtCreationParameters irrparam = new IrrlichtCreationParameters(); if (irrlichtPanel.IsDisposed) { throw new Exception("Form closed!"); } if (irrlichtPanel.InvokeRequired) { irrlichtPanel.Invoke(new MethodInvoker(delegate { irrparam.WindowID = irrlichtPanel.Handle; })); } irrparam.DriverType = DriverType.Direct3D9; irrparam.BitsPerPixel = 32; irrparam.AntiAliasing = 1; device = IrrlichtDevice.CreateDevice(irrparam); if (device == null) { throw new NullReferenceException("Could not create device for engine!"); } driver = device.VideoDriver; smgr = SceneManagerWolvenKit.Create(device); gui = device.GUIEnvironment; smgr.Attributes.SetValue("TW_TW3_TEX_PATH", depot); driver.SetTextureCreationFlag(TextureCreationFlag.Always32Bit, true); lightNode = smgr.AddLightSceneNode(null, new Vector3Df(0, 0, 0), new Colorf(1.0f, 1.0f, 1.0f), 200000.0f); smgr.AmbientLight = new Colorf(1.0f, 1.0f, 1.0f); worldNode = smgr.AddEmptySceneNode(); //NOTE: Witcher assets use Z up but Irrlicht uses Y up so rotate the model worldNode.Rotation = new Vector3Df(-90, 0, 0); //NOTE: We also need to flip the x-coordinate with this rotation worldNode.Scale = new Vector3Df(-1.0f, 1.0f, 1.0f); worldNode.Visible = true; var dome = smgr.AddSkyDomeSceneNode(driver.GetTexture("Terrain\\skydome.jpg"), 16, 8, 0.95f, 2.0f); dome.Visible = true; fpsText = gui.AddStaticText("FPS: 0", new Recti(2, 10, 200, 30), false, false, null, 1, false); fpsText.OverrideColor = IrrlichtLime.Video.Color.SolidRed; fpsText.OverrideFont = gui.GetFont("#DefaultWKFont"); vertexCountText = gui.AddStaticText("Vertices: " + totalVertexCount.ToString(), new Recti(2, 32, 300, 52), false, false, null, 1, false); vertexCountText.OverrideColor = IrrlichtLime.Video.Color.SolidRed; vertexCountText.OverrideFont = gui.GetFont("#DefaultWKFont"); meshCountText = gui.AddStaticText("Meshes: " + totalMeshCount.ToString(), new Recti(2, 54, 300, 74), false, false, null, 1, false); meshCountText.OverrideColor = IrrlichtLime.Video.Color.SolidRed; meshCountText.OverrideFont = gui.GetFont("#DefaultWKFont"); var camera = smgr.AddCameraSceneNodeWolvenKit(); camera.FarValue = 10000.0f; //distanceBar.Invoke((MethodInvoker)delegate //{ // camera.FarValue = (float)Math.Pow(10.0, (double)distanceBar.Value); //}); viewPort = driver.ViewPort; var lineMat = new IrrlichtLime.Video.Material { Lighting = false }; var WMatrix = new Matrix(new Vector3Df(0, 0, 0), smgr.ActiveCamera.ModelRotation); var PMatrix = new Matrix(); PMatrix = PMatrix.BuildProjectionMatrixOrthoLH(100, 80, 0.001f, 10000.0f); var VMatrix = new Matrix(); VMatrix = VMatrix.BuildCameraLookAtMatrixLH(new Vector3Df(50, 0, 0), new Vector3Df(0, 0, 0), new Vector3Df(0, 1f, 0)); int gizmoX = (int)(irrlichtPanel.Width * 0.92f); int gizmoY = (int)(irrlichtPanel.Height * 0.92f); var gizmoViewPort = new Recti(gizmoX, gizmoY, irrlichtPanel.Width, irrlichtPanel.Height); while (device.Run()) { if (this.Visible) { ProcessCommand(); driver.BeginScene(ClearBufferFlag.All); int val = driver.FPS; fpsText.Text = "FPS: " + val.ToString(); smgr.DrawAll(); gui.DrawAll(); // draw xyz axis right bottom driver.ViewPort = gizmoViewPort; driver.SetMaterial(lineMat); WMatrix.SetRotationRadians(smgr.ActiveCamera.ModelRotation * DEGREES_TO_RADIANS); driver.SetTransform(TransformationState.World, WMatrix); driver.SetTransform(TransformationState.Projection, PMatrix); driver.SetTransform(TransformationState.View, VMatrix); driver.Draw3DLine(0, 0, 0, 30f, 0, 0, IrrlichtLime.Video.Color.SolidGreen); driver.Draw3DLine(0, 0, 0, 0, 30f, 0, IrrlichtLime.Video.Color.SolidBlue); driver.Draw3DLine(0, 0, 0, 0, 0, 30f, IrrlichtLime.Video.Color.SolidRed); driver.ViewPort = viewPort; driver.EndScene(); } else { device.Yield(); } } } #if DEBUG catch (ThreadAbortException) { } catch (NullReferenceException) { } catch (Exception ex) { if (!this.IsDisposed) { MessageBox.Show(ex.Message); //this.Invoke(new MethodInvoker(delegate { this.Close(); })); } } #endif }
static void Main(string[] args) { DriverType driverType; if (!AskUserForDriver(out driverType)) { return; } device = IrrlichtDevice.CreateDevice(driverType, new Dimension2Di(640, 480)); if (device == null) { return; } device.SetWindowCaption("Irrlicht Engine - User Interface Demo"); device.SetWindowResizable(true); VideoDriver driver = device.VideoDriver; GUIEnvironment env = device.GUIEnvironment; GUISkin skin = env.Skin; GUIFont font = env.GetFont("../../media/fonthaettenschweiler.bmp"); if (font != null) { skin.SetFont(font); } skin.SetFont(env.BuiltInFont, GUIDefaultFont.Tooltip); env.AddButton(new Recti(10, 240, 110, 240 + 32), null, GUI_ID_ButtonQuit, "Quit", "Exits Program"); env.AddButton(new Recti(10, 280, 110, 280 + 32), null, GUI_ID_ButtonWindowNew, "New Window", "Launches a new Window"); env.AddButton(new Recti(10, 320, 110, 320 + 32), null, GUI_ID_ButtonFileOpen, "File Open", "Opens a file"); env.AddStaticText("Transparent Control:", new Recti(150, 20, 350, 40), true); GUIScrollBar scrollbar = env.AddScrollBar(true, new Recti(150, 45, 350, 60), null, GUI_ID_ScrollbarTransparency); scrollbar.MaxValue = 255; scrollbar.Position = (int)env.Skin.GetColor(GUIDefaultColor.WindowBackground).Alpha; GUIStaticText trq = env.AddStaticText("Logging ListBox:", new Recti(50, 110, 250, 130), true); listbox = env.AddListBox(new Recti(50, 140, 250, 210)); env.AddEditBox("Editable Text", new Recti(350, 80, 550, 100)); device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); env.AddImage(driver.GetTexture("../../media/irrlichtlogoalpha2.tga"), new Vector2Di(10, 10)); while (device.Run()) { if (device.WindowActive) { driver.BeginScene(true, true, new Color(200, 200, 200)); env.DrawAll(); driver.EndScene(); } } device.Drop(); }