Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/15/15 13:56:30 (8 years ago)
Author:
gkronber
Message:

#1966: removed SharpDX binaries since these are available through a transport plugin now (see #2504) and also made some changes to make the code work with the latest stable release of SharpDX

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/PackingGame.cs

    r13032 r13161  
    2222using System;
    2323using SharpDX;
    24 using SharpDX.Toolkit;     
     24using SharpDX.Direct3D11;
     25using SharpDX.Toolkit;
    2526using SharpDX.Toolkit.Graphics;
    2627using SharpDX.Toolkit.Input;
    2728
    2829using ButtonStateDX = SharpDX.Toolkit.Input.ButtonState;
    29 using SharpDX.Direct3D11;
     30
    3031
    3132namespace PackingPlanVisualizations {
     
    3334
    3435
    35     #region Global Private Variables   
     36    #region Global Private Variables
    3637    private GraphicsDeviceManager graphicsDeviceManager;
    3738    private PackingPlan3D control;
     
    4243    private int selectedItemIndex = -1;
    4344
    44     private BasicEffect basicEffect;     
     45    private BasicEffect basicEffect;
    4546    private Color backgroundColor { get; set; }
    4647
    47     private CenteredContainer container;   
     48    private CenteredContainer container;
    4849    private MouseManager Mouse;
    49     #endregion Global Private Variables     
     50    #endregion Global Private Variables
    5051
    5152    protected override void Dispose(bool disposeManagedResources) {
     
    5859    public PackingGame(PackingPlan3D control)
    5960      : base() {
    60         this.control = control;
     61      this.control = control;
    6162      graphicsDeviceManager = new GraphicsDeviceManager(this);
    6263      graphicsDeviceManager.PreferMultiSampling = true;
    63       graphicsDeviceManager.PreparingDeviceSettings += 
    64         (object sender, PreparingDeviceSettingsEventArgs e) => {           
     64      graphicsDeviceManager.PreparingDeviceSettings +=
     65        (object sender, PreparingDeviceSettingsEventArgs e) => {
    6566          e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = MSAALevel.X4;
    6667          return;
    6768        };
    6869      var controlColor = Color.White;//System.Drawing.SystemColors.Control;
    69       backgroundColor = new Color (controlColor.R,controlColor.G, controlColor.B, controlColor.A);
     70      backgroundColor = new Color(controlColor.R, controlColor.G, controlColor.B, controlColor.A);
    7071
    7172      Mouse = new MouseManager(this);
     
    135136      //Primitive color
    136137      basicEffect.AmbientLightColor = new Vector3(0.1f, 0.1f, 0.1f);
    137       basicEffect.DiffuseColor = new Vector3(1.0f, 1.0f, 1.0f);
     138      basicEffect.DiffuseColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
    138139      basicEffect.SpecularColor = new Vector3(0.25f, 0.25f, 0.25f);
    139140      basicEffect.SpecularPower = 5.0f;
     
    204205      GraphicsDevice.Clear(backgroundColor);
    205206
    206       worldMatrix = 
     207      worldMatrix =
    207208        Matrix.RotationY(MathUtil.DegreesToRadians(-currentViewAngle.X / 4)) *
    208209        Matrix.RotationX(MathUtil.DegreesToRadians(currentViewAngle.Y / 4));
     
    229230                item.RenderShapeTriangles(GraphicsDevice);
    230231              } else
    231                 item.RenderShapeLines(GraphicsDevice, new Color(0,0,0));
     232                item.RenderShapeLines(GraphicsDevice, new Color(0, 0, 0));
    232233            }
    233234          }
     
    235236      }
    236237
    237       base.Draw(gameTime);       
     238      base.Draw(gameTime);
    238239    }
    239240
     
    244245
    245246    protected override void Update(GameTime gameTime) {
    246       computeMouseHandling();                                     
     247      computeMouseHandling();
    247248      base.Update(gameTime);
    248249    }
     
    263264    private void computeLeftMouseBtnHandling(MouseState mouseState) {
    264265      //Left btn released
    265       if (mouseState.Left.Equals(ButtonStateDX.Released) && mouseState.Left.Equals(previousMouseState.Left)) {
     266      if (mouseState.LeftButton.Released && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) {
    266267        //Console.WriteLine("Released");
    267268      }
    268269
    269270      //Left btn pressed
    270       else if (mouseState.Left.Equals(ButtonStateDX.Pressed) && mouseState.Left.Equals(previousMouseState.Left)) {
     271      else if (mouseState.LeftButton.Pressed && mouseState.LeftButton.Equals(previousMouseState.LeftButton)) {
    271272        currentViewAngle = new Vector2(
    272273          viewAngleOnBtnRelease.X + mouseState.X - mousePositionOnBtnDown.X,
     
    279280
    280281      //Left btn freshly pressed ==> ONLICK-EVENT
    281       else if (mouseState.Left.Equals(ButtonStateDX.Pressed) && !previousMouseState.Left.Equals(ButtonStateDX.Pressed)) {
     282      else if (mouseState.LeftButton.Pressed && !previousMouseState.LeftButton.Pressed) {
    282283        Console.WriteLine("OnClick");
    283284        PackingPlan3D native = (PackingPlan3D)Window.NativeWindow;
     
    293294
    294295      //Left btn freshly released ==> ONRELEASE-EVENT
    295       else if (mouseState.Left.Equals(ButtonStateDX.Released) && !previousMouseState.Left.Equals(ButtonStateDX.Released)) {
     296      else if (mouseState.LeftButton.Released && !previousMouseState.LeftButton.Released) {
    296297        Console.WriteLine("OnRelease");
    297298        viewAngleOnBtnRelease = currentViewAngle;
Note: See TracChangeset for help on using the changeset viewer.