Пример #1
0
        public override bool OnMouse(int button, int state, int x, int y)
        {
            if (button == Glut.GLUT_LEFT_BUTTON && (state == Glut.GLUT_DOWN || state == Glut.GLUT_UP))
            {
//                MouseWorld = RenderLayerGame.ConvertScreenToWorldCoordsNoDepth(x, y, Camera.ViewMatrix, projectionMatrix, Vector3.Zero);
                MouseWorld = RenderLayerGame.ConvertScreenToWorldCoordsNoDepth(x, y, Matrix4.Identity, projectionMatrix,
                                                                               Vector3.Zero, TheRenderStatus);

                foreach (ObjHudPanel aHudObject in theHudPanels)
                {
                    ObjObject tempObj = aHudObject.IsOn((int)MouseWorld.x, (int)MouseWorld.y);
                    if (tempObj != null)
                    {
                        if (tempObj is ObjHudButton)
                        {
                            Tile.TileIds tempTileId;
                            string       tempTileIdName = (string)((ObjHudButton)tempObj).Tag;
                            if (Tile.TileIds.TryParse(tempTileIdName, true, out tempTileId))
                            {
                                selectedTileId = tempTileId;
                                selectedObjHudButton.Material = TheResourceManager.Get("Tile_" + tempTileIdName);
                            }
                        }

                        GameCore.TheGameCore.RaiseMessage("Mouse: [" + x + "," + y + "] on HUD: " + tempObj + ".");
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #2
0
        public void AddLayer(IRenderLayer aRenderLayer)
        {
            if (aRenderLayer is RenderLayerGame)
            {
                theRenderLayerGame = (RenderLayerGame)aRenderLayer;
            }

            RenderLayerBase tempLayerBase = (RenderLayerBase)aRenderLayer;

            tempLayerBase.Width              = width;
            tempLayerBase.Height             = height;
            tempLayerBase.TheUserInputPlayer = theUserInputPlayer;

            tempLayerBase.ReInitialize();

            theRenderLayers.Add(aRenderLayer);

            theRenderLayersRevered = new List <IRenderLayer>(theRenderLayers);
            theRenderLayersRevered.Reverse();
        }