Example #1
0
        private void FormGame_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            var resolver        = new GenericFileResolver("GameContent");
            var resourceManager = new ResourceManager(resolver);

            resourceManager.RegisterLoader(new Model3DLoader(), ".fbx");
            resourceManager.RegisterLoader(new Texture2DLoader(), ".png;.jpg;.bmp;.tga;.dds");

            model = resourceManager.Load <Model3DResource>("material_sample.fbx");

            floor = resourceManager.Load <Model3DResource>("floor.fbx");

            texture[0]      = resourceManager.Load <Texture2DResource>("DefaultMaterial_Base_Color.png");
            normalmap[0]    = resourceManager.Load <Texture2DResource>("DefaultMaterial_Normal_DirectX.png");
            metallicmap[0]  = resourceManager.Load <Texture2DResource>("DefaultMaterial_Metallic.png");
            roughnessmap[0] = resourceManager.Load <Texture2DResource>("DefaultMaterial_Roughness.png");

            texture[1]      = resourceManager.Load <Texture2DResource>("t1_c.png");
            normalmap[1]    = resourceManager.Load <Texture2DResource>("t1_n.png");
            metallicmap[1]  = resourceManager.Load <Texture2DResource>("t1_m.png");
            roughnessmap[1] = resourceManager.Load <Texture2DResource>("t1_r.png");

            texture[2]      = resourceManager.Load <Texture2DResource>("t2_c.png");
            normalmap[2]    = resourceManager.Load <Texture2DResource>("t2_n.png");
            metallicmap[2]  = resourceManager.Load <Texture2DResource>("t2_m.png");
            roughnessmap[2] = resourceManager.Load <Texture2DResource>("t2_r.png");

            texture[3]      = resourceManager.Load <Texture2DResource>("floor_c.png");
            normalmap[3]    = resourceManager.Load <Texture2DResource>("floor_n.png");
            metallicmap[3]  = resourceManager.Load <Texture2DResource>("floor_m.png");
            roughnessmap[3] = resourceManager.Load <Texture2DResource>("floor_r.png");

            cubemap = resourceManager.Load <Texture2DResource>("yoko.dds");

            control = new ControlViewport()
            {
                Dock = DockStyle.Fill
            };
            control.CustomRender += ControlOnCustomRender;
            Controls.Add(control);

            control.MouseMove += ControlOnMouseMove;
            control.KeyDown   += ControlOnKeyDown;
            control.KeyUp     += ControlOnKeyUp;

            gameLoopWatch      = Stopwatch.StartNew();
            gameTimer          = new Timer();
            gameTimer.Interval = 15;
            gameTimer.Tick    += GameTimerOnTick;
            gameTimer.Start();

            camera.Position = Vector3.ForwardLH * 10f;
        }
 public SchedulerControl()
 {
     InitializeComponent();
     HeaderOneHeight     = 32;
     HeaderTwoHeight     = 20;
     BarSpacing          = 32;
     BarHeight           = 20;
     MajorWidth          = 140;
     MinorWidth          = 20;
     TimeResolution      = TimeResolution.Day;
     this.DoubleBuffered = true;
     _mViewport          = new ControlViewport(this)
     {
         WheelDelta = BarSpacing
     };
     //AllowTaskDragDrop = true;
     ShowSlack      = true;
     ShowTaskLabels = true;
     this.Dock      = DockStyle.Fill;
     this.Margin    = new Padding(0, 0, 0, 0);
     this.Padding   = new Padding(0, 0, 0, 0);
     HeaderFormat   = new HeaderFormat()
     {
         Color         = Brushes.Black,
         Border        = new Pen(SystemColors.ActiveBorder),
         GradientLight = SystemColors.ButtonHighlight,
         GradientDark  = SystemColors.ButtonFace
     };
     MajorLabelFormat = new HeaderLabelFormat()
     {
         Font      = Font,
         Color     = HeaderFormat.Color,
         Margin    = 3,
         TextAlign = ChartTextAlign.MiddleCenter
     };
     MinorLabelFormat = new HeaderLabelFormat()
     {
         Font      = Font,
         Color     = HeaderFormat.Color,
         Margin    = 3,
         TextAlign = ChartTextAlign.MiddleCenter
     };
 }