public static void Main(string[] args) { device = new IrrlichtDevice(DriverType.OpenGL, new Dimension2D(640, 480), 32, false, true, false, false); if (device == null) { System.Console.WriteLine("Device could not be created. Exiting."); return; } device.WindowCaption = "Hello World - 2D Graphics Demo"; videoDriver = device.VideoDriver; sceneManager = device.SceneManager; guiEnvironment = device.GUIEnvironment; images = videoDriver.GetTexture("../../irrlicht/media/2ddemo.png"); videoDriver.MakeColorKeyTexture(images, new Position2D(0, 0)); font = guiEnvironment.BuiltInFont; font2 = guiEnvironment.GetFont("../../irrlicht/media/fonthaettenschweiler.bmp"); device.OnEvent += new OnEventDelegate(device_OnEvent); while (device.Run()) { RenderLoop(); } device.Drop(); }
public static void Main(string[] args) { device = new IrrlichtDevice(DriverType.OpenGL, new Dimension2D(640, 480), 32, false, true, false, false); if (device == null) { System.Console.WriteLine("Device could not be created. Exiting."); return; } device.WindowCaption = "Hello World - User Interface Demo"; device.Resizeable = true; videoDriver = device.VideoDriver; sceneManager = device.SceneManager; guiEnvironment = device.GUIEnvironment; GUISkin skin = guiEnvironment.Skin; GUIFont font = guiEnvironment.GetFont("../../irrlicht/media/fonthaettenschweiler.bmp"); if (!font.Null()) skin.Font = font; GUIButton button1 = guiEnvironment.AddButtonW(new Rect(10, 240, 110, 240 + 32), guiEnvironment.RootElement, (int)GuiIds.GUI_ID_QUIT_BUTTON, "Quit"); button1.ToolTipTextW = "Exits Program"; GUIButton button2 = guiEnvironment.AddButtonW(new Rect(10, 280, 110, 280 + 32), guiEnvironment.RootElement, (int)GuiIds.GUI_ID_NEW_WINDOW_BUTTON, "New Window"); button2.ToolTipTextW = "Launches a new Window"; GUIButton button3 = guiEnvironment.AddButtonW(new Rect(10, 320, 110, 320 + 32), guiEnvironment.RootElement, (int)GuiIds.GUI_ID_FILE_OPEN_BUTTON, "File Open"); button3.ToolTipTextW = "Opens a file"; guiEnvironment.AddStaticTextW("Transparency Control:", new Rect(150, 20, 350, 40), true, false, guiEnvironment.RootElement, -1, false); GUIScrollBar scrollBar = guiEnvironment.AddScrollBar(true, new Rect(150, 45, 350, 60), guiEnvironment.RootElement, (int)GuiIds.GUI_ID_TRANSPARENCY_SCROLL_BAR); scrollBar.Max = 255; scrollBar.Pos = guiEnvironment.Skin.GetColor(GuiDefaultColor.Window).A; guiEnvironment.AddStaticTextW("Logging ListBox:", new Rect(50, 110, 250, 130), true, false, guiEnvironment.RootElement, -1, false); listBox = guiEnvironment.AddListBox(new Rect(50, 140, 250, 210), guiEnvironment.RootElement, -1, true); guiEnvironment.AddEditBoxW("Editable Text", new Rect(350, 80, 550, 100), true, guiEnvironment.RootElement, -1); guiEnvironment.AddImage(videoDriver.GetTexture("../../irrlicht/media/irrlichtlogo2.png"), new Position2D(10, 10), true, guiEnvironment.RootElement, -1, ""); device.OnEvent += new OnEventDelegate(device_OnEvent); while (device.Run()) { RenderLoop(); } device.Drop(); }