// public int Type; public override void Render(int X, int Y, GraphicsDevice device, GUI.Renderer Renderer, bool RenderCooldown = false, bool RenderEXP = false) { Renderer.SetColour(this.Colour); Renderer.SetTexture(Renderer.InventoryPartsMap); Renderer.RenderIconEx(device, X, Y, 2048 + this.SubType); //body //base.Render(device, X, Y, RenderCooldown, RenderEXP); Renderer.SetColour(new Color(127, 127, 127, 127)); // Volatile.Console.Write("a"); base.Render(X, Y, device, Renderer, RenderCooldown, RenderEXP); }
public void Render(int X, int Y, GraphicsDevice device, GUI.Renderer Renderer, bool RenderCooldown = false, bool RenderEXP = false) { Renderer.SetTexture(Renderer.AbilityMap); Renderer.SetColour(Color.Gray); Renderer.RenderIconEx(device, X, Y, this.Icon); }
public void Init(GraphicsDevice device, ContentManager content) { GameModel.ModelGeometryCompiler.ModelBaseDir = "Scenes\\GameplayAssets\\Models\\"; GameObject.IO.MagicFileReader mr = new GameObject.IO.MagicFileReader(); List <CharacterTemplate> classes = mr.ReadClassFile(); List <ModularAbility> skills = mr.ReadAbilityFile(); abilities = skills; RotateMap = true; World = new World(device, 100) { Player = new GameObject.MapEntities.Actors.Player(classes[0], skills) }; World.Terrain.RenderDistance = 3; Generator = new WorldGen.WorldGenerator(World.Terrain.BlockSize, World, 4); World.Terrain.WaterHeight = Generator.WaterHeight; World.Player.WorldSpawn = World; World.Player.Abilities[0].Level = 1; World.Player.Abilities[1].Level = 2; World.Player.Abilities[2].Level = 5; if (OverheadMapTex == null) { OverheadMapTex = new RenderTarget2D(device, 256, 256, false, device.PresentationParameters.BackBufferFormat, device.PresentationParameters.DepthStencilFormat); } b = new SpriteBatch(device); #region load game textures Textures = new Dictionary <string, Texture2D>(); Textures["grass_overworld"] = LoadTex2D(device, "graphics\\terraintiles.png"); Textures["waterbump"] = LoadTex2D(device, "graphics\\waterbump.jpg"); Textures["rock"] = LoadTex2D(device, "graphics\\rock.jpg"); Textures["sand"] = LoadTex2D(device, "graphics\\sand.png"); Textures["point_sphere"] = LoadTex2D(device, "graphics\\sphere.png"); Textures["ray"] = LoadTex2D(device, "graphics\\ray.png"); Textures["mapsprites"] = LoadTex2D(device, "graphics\\mapsprites.png"); Textures["mapnavring"] = LoadTex2D(device, "graphics\\mapnavring.png"); Textures["mapoverlay"] = LoadTex2D(device, "graphics\\mapoverlay.png"); Textures["equipdoll"] = LoadTex2D(device, "graphics\\vitruvian.png"); Textures["dummy"] = LoadTex2D(device, "graphics\\gray.png"); Fonts = new Dictionary <string, SpriteFont>(); Fonts["font1"] = content.Load <SpriteFont>("font1"); Fonts["font1"].DefaultCharacter = '#'; Fonts["fontN"] = content.Load <SpriteFont>("LargeFontX"); Fonts["fontN"].DefaultCharacter = '#'; Fonts["FX"] = content.Load <SpriteFont>("FX"); GameModel.Model.TexturePool = Textures; #endregion GameModel.ModelPart.Textures = Textures; TerrainEffect = content.Load <Effect>("legacy"); World.Terrain.TerrainEffect = TerrainEffect; World.ModelEffect = TerrainEffect; World.Camera = World.Player.GetTheCamera(); World.Player.Position = new Vector3(0, 0, 0); World.Terrain.QThread = new Thread(new ThreadStart(ProcessQ)); World.Terrain.QThread.Start(); #region GUI - onlybasics GUIRenderer = new GUI.Renderer(device); GUIRenderer.WindowSkin = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\winskin.png", System.IO.FileMode.Open)); GUIRenderer.InventoryPartsMap = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\itemparts.png", System.IO.FileMode.Open)); GUIRenderer.AbilityMap = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\icons.png", System.IO.FileMode.Open)); GUIRenderer.GUIEffect = content.Load <Effect>("GUI"); GUIRenderer.UIFont = Fonts["font1"]; GUIRenderer.FloatFont = Fonts["fontN"]; WindowManager = new GUI.WindowManager(); WindowManager.Renderer = GUIRenderer; wlist = new Dictionary <string, GUI.Window>(); wlist["console"] = new GameplayAssets.ConsoleWindow(WindowManager, this); WindowManager.Add(wlist["console"]); Terrain.Console.WriteCallback = new Action <string>(ConsoleWrite); _3DGame.Console.WriteCallback = new Action <string>(ConsoleWrite); _3DGame.Console.WriteCallbackEx = new Action <string, List <Action> >(ConsoleWriteEx); GameObject.Console.WriteCallback = new Action <string>(ConsoleWrite); GameObject.Console.WriteCallbackEx = new Action <string, List <Action> >(ConsoleWriteEx); GUI.Console.WriteCallback = new Action <string>(ConsoleWrite); #endregion GameObject.Items.Material.MaterialTemplates.Load(); //GameObject.AbilityLogic.AbilityLoader l = new GameObject.AbilityLogic.AbilityLoader("Mage"); //World.Player.Abilities = l.LoadAbilities(); #region GUI - the rest of it wlist["status"] = new GameplayAssets.StatusWindow(WindowManager, World.Player); WindowManager.Add(wlist["status"]); wlist["nav"] = new GameplayAssets.Windows.NavWindow(World.Player, OverheadMapTex); WindowManager.Add(wlist["nav"]); wlist["target"] = new GameplayAssets.Windows.TargetWindow(WindowManager, World.Player); WindowManager.Add(wlist["target"]); wlist["inventory"] = new GameplayAssets.Windows.InventoryWindow(WindowManager, World.Player); WindowManager.Add(wlist["inventory"]); wlist["equipment"] = new GameplayAssets.Windows.EquipWindow(WindowManager, World.Player); WindowManager.Add(wlist["equipment"]); wlist["skills"] = new GameplayAssets.Windows.SkillTreeWindow(WindowManager, World.Player, abilities); WindowManager.Add(wlist["skills"]); wlist["fbinds"] = new GameplayAssets.Windows.FBindWindow(WindowManager, World.Player); WindowManager.Add(wlist["fbinds"]); ScreenResized(device); #endregion /*WorldGen.ObjectPopulator p = new WorldGen.ObjectPopulator(new Random(1)); * List<MapEntity> elist = p.GenerateObjectsTest(3); * foreach(MapEntity me in elist) * { * me.WorldSpawn = World; * World.Entities.Add(me); * } * //*/ }
public void Init(GraphicsDevice device, ContentManager content) { Fonts = new Dictionary <string, SpriteFont>(); Fonts["font1"] = content.Load <SpriteFont>("font1"); GUIRenderer = new GUI.Renderer(device); GUIRenderer.WindowSkin = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\winskin.png", System.IO.FileMode.Open)); GUIRenderer.InventoryPartsMap = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\itemparts.png", System.IO.FileMode.Open)); GUIRenderer.AbilityMap = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\icons.png", System.IO.FileMode.Open)); GUIRenderer.GUIEffect = content.Load <Effect>("GUI"); GUIRenderer.UIFont = Fonts["font1"]; Fonts["font1"].DefaultCharacter = '#'; WindowManager = new GUI.WindowManager(); WindowManager.Renderer = GUIRenderer; b = new SpriteBatch(device); map = new WorldMap(800, 800); Texture2D colortex = Texture2D.FromStream(device, new System.IO.FileStream("graphics\\minecraftgrass.png", System.IO.FileMode.Open)); map.ColourMap = new Color[colortex.Width * colortex.Height]; colortex.GetData <Color>(map.ColourMap); map.ColourMapSize = new Point(colortex.Width, colortex.Height); int seed = new System.Random().Next(100); Simplex.Seed = seed; WorldMapFeatureGenerator.Seed = seed; //WorldMapFeatureGenerator.MakeEllipse(map, 30, 30, 720, 440); //WorldMapFeatureGenerator.MakeEllipse(map, 30, 500, 320, 240); //WorldMapFeatureGenerator.MakeEllipse(map, 430, 500, 350, 200); WorldMapFeatureGenerator.MakeEllipse(map, 30, 30, 720, 640); WorldMapFeatureGenerator.FillOcean(map); for (int x = 0; x < map.Width; x++) { for (int y = 0; y < map.Height; y++) { if (map.TileData[x, y] == WorldMap.TileType.Unfilled) { map.ElevationData[x, y] = 0.1f; } } } WorldMapFeatureGenerator.Replace(map, WorldMap.TileType.Unfilled, WorldMap.TileType.Plain); map.OceanDistanceField = WorldMapFeatureGenerator.DoDistanceField(map, map.OceanDistanceField, WorldMap.TileType.Ocean); List <Point> rivers = WorldMapFeatureGenerator.DoRivers(map, 10); map.RiverDistanceField = WorldMapFeatureGenerator.DoDistanceField(map, map.RiverDistanceField, WorldMap.TileType.River); WorldMapFeatureGenerator.DoTemperature(map); WorldMapFeatureGenerator.DoMountains(map, 6666); WorldMapFeatureGenerator.DoHumidity(map); map.Towns = WorldMapFeatureGenerator.PlaceTownCentres(map, 50, 60, rivers, 30); WorldMapFeatureGenerator.GrowTowns(map, 3, 100); map.TileData[36, 14] = WorldMap.TileType.Beach; Texture2D result = map.TilesToTexture(device); CreateWorldAssets.Windows.MapWindow mw = new CreateWorldAssets.Windows.MapWindow(result); WindowManager.Add(mw); ScreenResized(device); }