source: 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Render/GuiRenderer.cs @ 5626

Revision 5626, 1.7 KB checked in by mijoilmo, 6 years ago (diff)

varjosimulaattori

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using Microsoft.Xna.Framework;
5using Microsoft.Xna.Framework.Content;
6using Microsoft.Xna.Framework.Graphics;
7
8namespace WindowsGame1
9{
10    public class GuiRenderer
11    {
12        RendererBase r;
13        Map map;
14        Camera camera;
15        public GuiRenderer(RendererBase r, Map map, Camera camera)
16        {
17            this.r = r;
18            this.map = map;
19            this.camera = camera;
20        }
21        public void Render(Matrix matrix)
22        {
23            /*r.spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, matrix);
24            float mapSizeInPixels = 64 * camera.zoomFactor;
25            Vector2 mousePos = new Vector2(Pikseli.Instance.mousePos.X, Pikseli.Instance.mousePos.Y);
26
27            Matrix inv = Matrix.Invert(matrix);
28            mousePos = Vector2.Transform(mousePos, inv);
29
30            Vector2 selectionPos = new Vector2(
31                mousePos.X / mapSizeInPixels - camera.size.X / mapSizeInPixels / 2 + map.Size.X / 2 - camera.offset.X / mapSizeInPixels * camera.zoomFactor,
32                mousePos.Y / mapSizeInPixels - camera.size.Y / mapSizeInPixels / 2 + map.Size.Y / 2 - camera.offset.Y / mapSizeInPixels * camera.zoomFactor
33                );
34
35            r.renderGroundTile(Pikseli.Instance.textures["test/select"],
36                (int)(selectionPos.X),
37                (int)(selectionPos.Y)
38            );
39            r.spriteBatch.End();*/
40            r.spriteBatch.Begin();
41            r.spriteBatch.Draw(Pikseli.Instance.textures["gui/cursor"], Pikseli.Instance.mousePos, Color.White);
42            r.spriteBatch.End();
43        }
44    }
45}
Note: See TracBrowser for help on using the repository browser.