Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » DirectX » Games » Downloads
 
Add your own
alternative version

Game Engine

, 20 Nov 2009 CPL
A game engine first prototype
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MTV3D65;


namespace gefx
{
   public  class PickUpRect
    {

       public TVScreen2DImmediate screen = new TVScreen2DImmediate();
       TV_2DVECTOR P1;
       TV_2DVECTOR P2;
       TV_3DVECTOR GetMouseLandPosition;


       public TV_2DVECTOR Mouse1Coor;
       public TV_2DVECTOR Mouse2Coor;
       public TV_2DVECTOR Mouse3Coor;
       public TV_2DVECTOR Mouse4Coor;
       public TV_2DVECTOR tMouse1Coor;
       public TV_2DVECTOR tMouse2Coor;
       public TV_3DVECTOR tmpDest;
       public TV_3DVECTOR tmpDest2;
       TVCollisionResult CollResult = new TVCollisionResult();
       // //Screen.Draw_Box(XActor.Mouse1Coor.x,
       //XActor.Mouse1Coor.y, XActor.Mouse2Coor.x, 
       //XActor.Mouse2Coor.y, Globals.RGBA(0, 1, 0, 1));
       bool MouseB1 = false;

       public void DrawSelectionRect( XCamera Kamera,Terrain Teren, ref TVScene Scene,ref TVGlobals Globals,TVInputEngine Inp)
       {
           #region MyRegion
           float MouseX = Kamera.tmpMouseX1;
           float MouseY = Kamera.tmpMouseY1;


           if (Inp.IsMouseButtonPressed(0) == true)
           {
               if (MouseB1 == false)
               {
                   Mouse1Coor.x = MouseX;
                   Mouse1Coor.y = MouseY;
                   MouseB1 = true;
                   Mouse2Coor.x = MouseX;
                   Mouse2Coor.y = MouseY;
               }
           }

           if (MouseB1 == true)
           {
               Mouse2Coor.x = MouseX;
               Mouse2Coor.y = MouseY;
           }

           if (Inp.IsMouseButtonPressed(0) == false)
           {
               if (MouseB1 == true)
               {
                   Mouse2Coor.x = MouseX;
                   Mouse2Coor.y = MouseY;

                   Mouse3Coor.x = Mouse1Coor.x;
                   Mouse3Coor.y = Mouse2Coor.y;
                   Mouse4Coor.x = Mouse2Coor.x;
                   Mouse4Coor.y = Mouse1Coor.y;
                   MouseB1 = false;

                   //select units
                   CollResult = Scene.MousePick((int)Mouse1Coor.x, (int)Mouse1Coor.y, (int)MTV3D65.CONST_TV_OBJECT_TYPE.TV_OBJECT_LANDSCAPE, CONST_TV_TESTTYPE.TV_TESTTYPE_ACCURATETESTING);
                   Mouse1Coor.x = CollResult.GetCollisionImpact().x;
                   Mouse1Coor.y = CollResult.GetCollisionImpact().z;
                   CollResult = Scene.MousePick((int)Mouse2Coor.x, (int)Mouse2Coor.y, (int)MTV3D65.CONST_TV_OBJECT_TYPE.TV_OBJECT_LANDSCAPE, CONST_TV_TESTTYPE.TV_TESTTYPE_ACCURATETESTING);
                   Mouse2Coor.x = CollResult.GetCollisionImpact().x;
                   Mouse2Coor.y = CollResult.GetCollisionImpact().z;

                   tMouse1Coor = Mouse1Coor;
                   tMouse2Coor = Mouse2Coor;
                   screen.Action_Begin2D();
                            screen.Draw_Box(tMouse1Coor.x,
                                tMouse1Coor.y, Mouse2Coor.x,
                                Mouse2Coor.y, Globals.RGBA(0, 1, 0, 1));
                            screen.Action_End2D();


                   if (Mouse1Coor.x < Mouse2Coor.x & Mouse1Coor.y < Mouse2Coor.y)
                   {
                       tMouse1Coor.y = Mouse2Coor.y;
                       tMouse2Coor.y = Mouse1Coor.y;
                   }
                   else if (Mouse1Coor.x < Mouse2Coor.x & Mouse1Coor.y > Mouse2Coor.y)
                   {
                       tMouse1Coor = Mouse1Coor;
                       tMouse2Coor = Mouse2Coor;
                   }
                   else if (Mouse1Coor.x > Mouse2Coor.x & Mouse1Coor.y > Mouse2Coor.y)
                   {
                       tMouse1Coor.x = Mouse2Coor.x;
                       tMouse2Coor.x = Mouse1Coor.x;
                   }
                   else if (Mouse1Coor.x > Mouse2Coor.x & Mouse1Coor.y < Mouse2Coor.y)
                   {
                       tMouse1Coor = Mouse2Coor;
                       tMouse2Coor = Mouse1Coor;
                   }

              //     screen.Draw_Box(tMouse1Coor.x,
              //tMouse1Coor.y, Mouse2Coor.x,
              //Mouse2Coor.y, Globals.RGBA(0, 1, 0, 1));

               }
           }
           
           #endregion
           
          
           
       }

    }


}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Public License Version 1.0 (CPL)

Share

About the Author

Member 3873633
Software Developer
Croatia Croatia
Programer

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 20 Nov 2009
Article Copyright 2009 by Member 3873633
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid