Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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 - Irrlicht.Net Demo";

            videoDriver = device.VideoDriver;
            sceneManager = device.SceneManager;
            guiEnvironment = device.GUIEnvironment;

            guiEnvironment.AddStaticTextW("Hello World! This is the Irrlicht.Net demo application", new Rect(10, 10, 590, 32), true, false, guiEnvironment.RootElement, -1, false);

            AnimatedMesh mesh = sceneManager.GetMesh("../../irrlicht/media/sydney.md2");
            if (mesh == null)
            {
                System.Console.WriteLine("Meshfile could not be loaded");
                return;
            }
            AnimatedMeshSceneNode node = sceneManager.AddAnimatedMeshSceneNode(mesh);
            if (node != null)
            {
                node.SetMaterialFlag(MaterialFlag.Lighting, false);
                node.SetMD2Animation(MD2Animation.Stand);
                node.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/sydney.bmp"));
            }

            CameraSceneNode camera = sceneManager.AddCameraSceneNode(sceneManager.RootSceneNode);
            camera.Position = new Vector3D(0, 30, -40);
            camera.Target = new Vector3D(0, 5, 0);

            device.OnEvent += new OnEventDelegate(device_OnEvent);

            while (device.Run())
            {
                RenderLoop();
            }

            device.Drop();
        }
Exemplo n.º 4
0
 public void MakeColorKey(VideoDriver drv, Color color)
 {
     drv.MakeColorKeyTexture(this, color);
 }
Exemplo n.º 5
0
 public void MakeColorKey(VideoDriver drv, Position2D colorKeyPixelPos)
 {
     drv.MakeColorKeyTexture(this, colorKeyPixelPos);
 }
Exemplo n.º 6
0
 public void MakeColorKey(VideoDriver drv)
 {
     drv.MakeColorKeyTexture(this, new Position2D(0, 0));
 }
Exemplo n.º 7
0
        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 = "Movement - Irrlicht.Net Demo";

            videoDriver = device.VideoDriver;
            sceneManager = device.SceneManager;
            guiEnvironment = device.GUIEnvironment;

            node = sceneManager.AddSphereSceneNode(1.0f, 32, sceneManager.RootSceneNode);
            node.Position = new Vector3D(0.0f, 0.0f, 30.0f);
            node.SetMaterialFlag(MaterialFlag.Lighting, false);
            node.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/wall.bmp"));

            SceneNode n = sceneManager.AddCubeSceneNode(1.0f, sceneManager.RootSceneNode, -1);
            n.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/t351sml.jpg"));
            n.SetMaterialFlag(MaterialFlag.Lighting, false);
            Animator anim = sceneManager.CreateFlyCircleAnimator(new Vector3D(0.0f, 0.0f, 30.0f), 20.0f, 0.01f);
            n.AddAnimator(anim);
            anim.Drop();

            AnimatedMesh mesh = sceneManager.GetMesh("../../irrlicht/media/sydney.md2");
            if (mesh == null)
            {
                System.Console.WriteLine("Meshfile could not be loaded");
                return;
            }
            AnimatedMeshSceneNode anode = sceneManager.AddAnimatedMeshSceneNode(mesh);
            if (anode != null)
            {
                anode.SetMaterialFlag(MaterialFlag.Lighting, false);
                anode.SetMD2Animation(MD2Animation.Stand);
                anode.SetMaterialTexture(0, videoDriver.GetTexture("../../irrlicht/media/sydney.bmp"));
                anode.SetFrameLoop(160, 180);
                anode.AnimationSpeed = 30;
                anode.Rotation = new Vector3D(0, 180, 0);
            }

            Animator anims = sceneManager.CreateFlyStraightAnimator(new Vector3D(100, 0, 60), new Vector3D(-100, 0, 60), 5000, true);
            anode.AddAnimator(anims);
            anims.Drop();

            CameraSceneNode camera = sceneManager.AddCameraSceneNodeFPS(sceneManager.RootSceneNode, 100, 100, false);
            camera.Position = new Vector3D(0, 30, -40);
            camera.Target = new Vector3D(0, 5, 0);

            device.CursorControl.Visible = true;

            device.OnEvent += new OnEventDelegate(device_OnEvent);

            while (device.Run())
            {
                RenderLoop();
            }

            device.Drop();
        }