updated crafting
|
After Width: | Height: | Size: 4.0 MiB |
|
After Width: | Height: | Size: 218 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 217 B |
|
|
@ -14,6 +14,10 @@ public class Window
|
||||||
h,
|
h,
|
||||||
SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL_WindowFlags.SDL_WINDOW_RESIZABLE
|
SDL_WindowFlags.SDL_WINDOW_OPENGL | SDL_WindowFlags.SDL_WINDOW_RESIZABLE
|
||||||
);
|
);
|
||||||
|
var (ptr, size) = new ResourceLoader().LoadToIntPtr("assets.icon.png");
|
||||||
|
var sdlBuffer = SDL_RWFromMem(ptr, size);
|
||||||
|
var surface = IMG_Load_RW(sdlBuffer, 1);
|
||||||
|
SDL_SetWindowIcon(this.window, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Window(string title, int x, int y, int w, int h, SDL_WindowFlags flags)
|
public Window(string title, int x, int y, int w, int h, SDL_WindowFlags flags)
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,7 @@ public class Connect
|
||||||
Position = new Vector2(512244, 5390),
|
Position = new Vector2(512244, 5390),
|
||||||
};
|
};
|
||||||
ctx.GameState.Players.Add(
|
ctx.GameState.Players.Add(
|
||||||
new Player
|
player
|
||||||
{
|
|
||||||
Name = packet.PlayerName,
|
|
||||||
Id = packet.PlayerGuid,
|
|
||||||
Position = new Vector2(512244, 5390),
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@ public class Bootstrapper
|
||||||
{
|
{
|
||||||
var ctx = Context.Get();
|
var ctx = Context.Get();
|
||||||
ctx.GameState.World = new World();
|
ctx.GameState.World = new World();
|
||||||
ctx.GameState.World.AddChunk(ChunkGenerator.CreateFilledChunk(0, 1, STile.From(Tiles.Stone)));
|
ChunkGenerator.CreateSpawnChunk(1000, 10);
|
||||||
ctx.GameState.World.AddChunk(ChunkGenerator.CreateSpawnChunk(1000, 10));
|
|
||||||
ctx.GameState.World.AddChunk(ChunkGenerator.CreateFilledChunk(1, 0, STile.From(Tiles.Stone)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,16 @@ public enum ItemId
|
||||||
Coal = 120,
|
Coal = 120,
|
||||||
GoldIngot = 121,
|
GoldIngot = 121,
|
||||||
IronIngot = 122,
|
IronIngot = 122,
|
||||||
|
CopperIngot = 123,
|
||||||
|
SilverIngot = 124,
|
||||||
PickaxeBasic = 200,
|
PickaxeBasic = 200,
|
||||||
PickaxeStone = 201,
|
PickaxeStone = 201,
|
||||||
PickaxeIron = 202,
|
PickaxeIron = 202,
|
||||||
PickaxeGold = 203,
|
PickaxeGold = 203,
|
||||||
|
CopperWire = 300,
|
||||||
|
Silicon = 301,
|
||||||
|
CircuitBoard = 302,
|
||||||
|
ElectricCircuit = 303,
|
||||||
|
Fuse = 304,
|
||||||
|
Gps = 400,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,24 @@ public class ItemRegistry
|
||||||
this.Register(ItemId.RawUranium, new Item(ItemId.RawUranium, "Raw Uranium", "items.raw-uranium" ));
|
this.Register(ItemId.RawUranium, new Item(ItemId.RawUranium, "Raw Uranium", "items.raw-uranium" ));
|
||||||
this.Register(ItemId.Diamond, new Item(ItemId.Diamond, "Diamond", "items.diamond" ));
|
this.Register(ItemId.Diamond, new Item(ItemId.Diamond, "Diamond", "items.diamond" ));
|
||||||
this.Register(ItemId.Coal, new Item(ItemId.Coal, "Coal", "items.coal" ));
|
this.Register(ItemId.Coal, new Item(ItemId.Coal, "Coal", "items.coal" ));
|
||||||
|
// Ingots
|
||||||
this.Register(ItemId.IronIngot, new Item(ItemId.IronIngot, "Iron Ingot", "items.ingot-iron" ));
|
this.Register(ItemId.IronIngot, new Item(ItemId.IronIngot, "Iron Ingot", "items.ingot-iron" ));
|
||||||
this.Register(ItemId.GoldIngot, new Item(ItemId.GoldIngot, "Gold Ingot", "items.ingot-gold" ));
|
this.Register(ItemId.GoldIngot, new Item(ItemId.GoldIngot, "Gold Ingot", "items.ingot-gold" ));
|
||||||
|
this.Register(ItemId.CopperIngot, new Item(ItemId.CopperIngot, "Copper Ingot", "items.ingot-copper" ));
|
||||||
|
this.Register(ItemId.SilverIngot, new Item(ItemId.SilverIngot, "Silver Ingot", "items.ingot-silver" ));
|
||||||
|
// Pickaxes
|
||||||
this.Register(ItemId.PickaxeBasic, new PickaxeItem(ItemId.PickaxeBasic, "Basic Pickaxe", "items.pickaxe-basic", 15, 4));
|
this.Register(ItemId.PickaxeBasic, new PickaxeItem(ItemId.PickaxeBasic, "Basic Pickaxe", "items.pickaxe-basic", 15, 4));
|
||||||
this.Register(ItemId.PickaxeStone, new PickaxeItem(ItemId.PickaxeStone, "Stone Pickaxe", "items.pickaxe-stone", 25, 6));
|
this.Register(ItemId.PickaxeStone, new PickaxeItem(ItemId.PickaxeStone, "Stone Pickaxe", "items.pickaxe-stone", 25, 6));
|
||||||
this.Register(ItemId.PickaxeIron, new PickaxeItem(ItemId.PickaxeIron, "Iron Pickaxe", "items.pickaxe-iron", 40, 7));
|
this.Register(ItemId.PickaxeIron, new PickaxeItem(ItemId.PickaxeIron, "Iron Pickaxe", "items.pickaxe-iron", 40, 7));
|
||||||
this.Register(ItemId.PickaxeGold, new PickaxeItem(ItemId.PickaxeGold, "Gold Pickaxe", "items.pickaxe-gold", 60, 8));
|
this.Register(ItemId.PickaxeGold, new PickaxeItem(ItemId.PickaxeGold, "Gold Pickaxe", "items.pickaxe-gold", 60, 8));
|
||||||
|
// Materials
|
||||||
|
this.Register(ItemId.CopperWire, new Item(ItemId.CopperWire, "Copper Wire", "items.copper-wire" ));
|
||||||
|
this.Register(ItemId.Silicon, new Item(ItemId.Silicon, "Silicon", "items.silicon" ));
|
||||||
|
this.Register(ItemId.CircuitBoard, new Item(ItemId.CircuitBoard, "Circuit Board", "items.circuit-board" ));
|
||||||
|
this.Register(ItemId.ElectricCircuit, new Item(ItemId.ElectricCircuit, "Electric Circuit", "items.electric-circuit" ));
|
||||||
|
this.Register(ItemId.Fuse, new Item(ItemId.Fuse, "Fuse", "items.fuse" ));
|
||||||
|
// Utilities
|
||||||
|
this.Register(ItemId.Gps, new Item(ItemId.Gps, "GPS", "items.gps" ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Register(ItemId id, Item item)
|
public void Register(ItemId id, Item item)
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,76 @@ public class Workbench : Tile
|
||||||
new ItemStack(ItemId.RawGold, 1),
|
new ItemStack(ItemId.RawGold, 1),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.CopperIngot, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.Coal, 1),
|
||||||
|
new ItemStack(ItemId.RawCopper, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.SilverIngot, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.Coal, 1),
|
||||||
|
new ItemStack(ItemId.RawSilver, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.CopperWire, 4),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.CopperIngot, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.Silicon, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.Stone, 16),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.CircuitBoard, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.Silicon, 1),
|
||||||
|
new ItemStack(ItemId.CopperWire, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.ElectricCircuit, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.CircuitBoard, 1),
|
||||||
|
new ItemStack(ItemId.CopperWire, 5),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.Fuse, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.CopperWire, 1),
|
||||||
|
new ItemStack(ItemId.Stone, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Recipes.Add(new Recipe
|
||||||
|
{
|
||||||
|
Result = new ItemStack(ItemId.Gps, 1),
|
||||||
|
Ingredients = new List<ItemStack>
|
||||||
|
{
|
||||||
|
new ItemStack(ItemId.ElectricCircuit, 1),
|
||||||
|
new ItemStack(ItemId.Fuse, 1),
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsSolid()
|
public override bool IsSolid()
|
||||||
|
|
|
||||||
|
|
@ -76,16 +76,9 @@ public class ChunkGenerator
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Chunk CreateSpawnChunk(int x, int y)
|
public static void CreateSpawnChunk(int x, int y)
|
||||||
{
|
{
|
||||||
var chunk = new Chunk(x, y);
|
var chunk = CreateChunk(x, y);
|
||||||
for (var i = 0; i < Constants.ChunkSize; i++)
|
|
||||||
{
|
|
||||||
for (var j = 0; j < Constants.ChunkSize; j++)
|
|
||||||
{
|
|
||||||
chunk.SetTile(i, j, STile.From(Tiles.Stone));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chunk.SetTile(16, 16, STile.From(0));
|
chunk.SetTile(16, 16, STile.From(0));
|
||||||
chunk.SetTile(15, 16, STile.From(0));
|
chunk.SetTile(15, 16, STile.From(0));
|
||||||
chunk.SetTile(16, 15, STile.From(0));
|
chunk.SetTile(16, 15, STile.From(0));
|
||||||
|
|
@ -95,7 +88,12 @@ public class ChunkGenerator
|
||||||
chunk.SetTile(17, 16, STile.From(0));
|
chunk.SetTile(17, 16, STile.From(0));
|
||||||
chunk.SetTile(14, 16, STile.From(0));
|
chunk.SetTile(14, 16, STile.From(0));
|
||||||
chunk.SetTile(16, 14, STile.From(0));
|
chunk.SetTile(16, 14, STile.From(0));
|
||||||
|
chunk.SetTile(15, 14, STile.From(0));
|
||||||
chunk.SetTile(17, 16, STile.From((int)Tiles.Workbench));
|
chunk.SetTile(17, 16, STile.From((int)Tiles.Workbench));
|
||||||
return chunk;
|
chunk.SetTile(14, 17, STile.From((int)Tiles.Stone));
|
||||||
|
chunk.SetTile(15, 17, STile.From((int)Tiles.Stone));
|
||||||
|
chunk.SetTile(16, 17, STile.From((int)Tiles.Stone));
|
||||||
|
chunk.SetTile(17, 17, STile.From((int)Tiles.Stone));
|
||||||
|
Context.Get().GameState.World.AddChunk(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Mine2d.engine;
|
||||||
using Mine2d.game.core.data;
|
using Mine2d.game.core.data;
|
||||||
|
|
||||||
namespace Mine2d.game.frontend;
|
namespace Mine2d.game.frontend;
|
||||||
|
|
@ -15,6 +16,11 @@ public static class ItemRenderer
|
||||||
var texture = stack.GetTexture();
|
var texture = stack.GetTexture();
|
||||||
var renderer = Context.Get().Renderer;
|
var renderer = Context.Get().Renderer;
|
||||||
var uiScale = Context.Get().FrontendGameState.Settings.UiScale;
|
var uiScale = Context.Get().FrontendGameState.Settings.UiScale;
|
||||||
|
Renderer.ProcessStatus(SDL_SetTextureColorMod(texture, 0, 0, 0));
|
||||||
|
Renderer.ProcessStatus(SDL_SetTextureAlphaMod(texture, 128));
|
||||||
|
renderer.DrawTexture(texture, (int)position.X + uiScale, (int)position.Y + uiScale, 16 * uiScale, 16 * uiScale);
|
||||||
|
Renderer.ProcessStatus(SDL_SetTextureColorMod(texture, 255, 255, 255));
|
||||||
|
Renderer.ProcessStatus(SDL_SetTextureAlphaMod(texture, 255));
|
||||||
renderer.DrawTexture(texture, (int)position.X, (int)position.Y, 16 * uiScale, 16 * uiScale);
|
renderer.DrawTexture(texture, (int)position.X, (int)position.Y, 16 * uiScale, 16 * uiScale);
|
||||||
if (stack.Count > 1)
|
if (stack.Count > 1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class PlayerInventoryRenderer : Inventory
|
||||||
var pickaxe = player.Inventory.Pickaxe;
|
var pickaxe = player.Inventory.Pickaxe;
|
||||||
if (pickaxe != null)
|
if (pickaxe != null)
|
||||||
{
|
{
|
||||||
ItemRenderer.RenderItemStack(pickaxe, new Vector2(((4 + (9 * 21)) * uiScale) + x, (((5 * 21) + 4) * uiScale) + y), player.Inventory.Cursor == null, "Test\nTT");
|
ItemRenderer.RenderItemStack(pickaxe, new Vector2(((4 + (9 * 21)) * uiScale) + x, (((5 * 21) + 4) * uiScale) + y), player.Inventory.Cursor == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,24 @@ public class WorkbenchInventory : Inventory
|
||||||
|
|
||||||
PlayerInventoryRenderer.Render(this.x, this.y + (50 * uiScale));
|
PlayerInventoryRenderer.Render(this.x, this.y + (50 * uiScale));
|
||||||
var rX = this.x + (4 * uiScale);
|
var rX = this.x + (4 * uiScale);
|
||||||
|
var xOffset = 0;
|
||||||
|
var yOffset = 0;
|
||||||
var rY = this.y + (4 * uiScale);
|
var rY = this.y + (4 * uiScale);
|
||||||
foreach ( var r in Workbench.Recipes) {
|
foreach (var r in Workbench.Recipes)
|
||||||
|
{
|
||||||
var desc = "Requires:\n";
|
var desc = "Requires:\n";
|
||||||
foreach (var i in r.Ingredients) {
|
foreach (var i in r.Ingredients)
|
||||||
|
{
|
||||||
desc += $"{i.Count}x {i.GetName()}\n";
|
desc += $"{i.Count}x {i.GetName()}\n";
|
||||||
}
|
}
|
||||||
ItemRenderer.RenderItemStack(r.Result, new Vector2(rX, rY), true, desc);
|
ItemRenderer.RenderItemStack(r.Result, new Vector2(rX + xOffset, rY + yOffset), true, desc);
|
||||||
rX += 21 * uiScale;
|
|
||||||
|
xOffset += 21 * uiScale;
|
||||||
|
if (xOffset == 21 * uiScale * 9)
|
||||||
|
{
|
||||||
|
xOffset = 0;
|
||||||
|
yOffset += 21 * uiScale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,27 +59,39 @@ public class WorkbenchInventory : Inventory
|
||||||
var cursorPosition = Context.Get().FrontendGameState.CursorPosition;
|
var cursorPosition = Context.Get().FrontendGameState.CursorPosition;
|
||||||
var player = PlayerEntity.GetSelf();
|
var player = PlayerEntity.GetSelf();
|
||||||
var rX = this.x + (4 * uiScale);
|
var rX = this.x + (4 * uiScale);
|
||||||
|
var xOffset = 0;
|
||||||
|
var yOffset = 0;
|
||||||
var rY = this.y + (4 * uiScale);
|
var rY = this.y + (4 * uiScale);
|
||||||
foreach ( var r in Workbench.Recipes) {
|
foreach (var r in Workbench.Recipes)
|
||||||
if(cursorPosition.X >= rX && cursorPosition.X <= rX + (21 * uiScale) && cursorPosition.Y >= rY && cursorPosition.Y <= rY + (21 * uiScale)) {
|
{
|
||||||
|
if (cursorPosition.X >= rX + xOffset && cursorPosition.X <= rX + xOffset + (21 * uiScale) && cursorPosition.Y >= rY + yOffset && cursorPosition.Y <= rY + yOffset + (21 * uiScale))
|
||||||
|
{
|
||||||
Console.WriteLine("Clicked on recipe" + r.Result.GetName());
|
Console.WriteLine("Clicked on recipe" + r.Result.GetName());
|
||||||
var canCraft = true;
|
var canCraft = true;
|
||||||
foreach (var i in r.Ingredients) {
|
foreach (var i in r.Ingredients)
|
||||||
if (!player.Inventory.HasItemStack(i)) {
|
{
|
||||||
|
if (!player.Inventory.HasItemStack(i))
|
||||||
|
{
|
||||||
canCraft = false;
|
canCraft = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (canCraft) {
|
if (canCraft)
|
||||||
foreach (var i in r.Ingredients) {
|
{
|
||||||
|
foreach (var i in r.Ingredients)
|
||||||
|
{
|
||||||
player.Inventory.RemoveItemStack(i);
|
player.Inventory.RemoveItemStack(i);
|
||||||
}
|
}
|
||||||
player.Inventory.PickupItemStack(r.Result);
|
player.Inventory.PickupItemStack(r.Result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xOffset += 21 * uiScale;
|
||||||
rX += 21 * uiScale;
|
if (xOffset == 21 * uiScale * 9)
|
||||||
|
{
|
||||||
|
xOffset = 0;
|
||||||
|
yOffset += 21 * uiScale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using Mine2d.engine;
|
using Mine2d.engine;
|
||||||
using Mine2d.engine.utils;
|
using Mine2d.engine.utils;
|
||||||
using Mine2d.game.core;
|
using Mine2d.game.core;
|
||||||
|
using Mine2d.game.core.data;
|
||||||
|
|
||||||
namespace Mine2d.game.frontend.renderer;
|
namespace Mine2d.game.frontend.renderer;
|
||||||
|
|
||||||
|
|
@ -30,6 +31,7 @@ public class HudRenderer : IRenderer
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
this.RenderHotbar();
|
this.RenderHotbar();
|
||||||
|
this.RenderGps();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RenderHotbar()
|
private void RenderHotbar()
|
||||||
|
|
@ -52,4 +54,22 @@ public class HudRenderer : IRenderer
|
||||||
ItemRenderer.RenderItemStack(stack, new Vector2((4 + (i * 24)) * uiScale, 4 * uiScale));
|
ItemRenderer.RenderItemStack(stack, new Vector2((4 + (i * 24)) * uiScale, 4 * uiScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RenderGps()
|
||||||
|
{
|
||||||
|
var player = PlayerEntity.GetSelf();
|
||||||
|
if (player?.Inventory.HasItemStack(new ItemStack(ItemId.Gps, 1)) != true) return;
|
||||||
|
var renderer = Context.Get().Renderer;
|
||||||
|
var (wWidth, _) = Context.Get().Window.GetSize();
|
||||||
|
var x = player.PrettyPosition.X.ToString("F2");
|
||||||
|
var y = player.PrettyPosition.Y.ToString("F2");
|
||||||
|
var (texture, width, height, surfaceMessage) = renderer.CreateTextTexture("GPS");
|
||||||
|
renderer.DrawTexture(texture, wWidth - width, 0, width, height);
|
||||||
|
SDL_DestroyTexture(texture);
|
||||||
|
SDL_FreeSurface(surfaceMessage);
|
||||||
|
(texture, width, height, surfaceMessage) = renderer.CreateTextTexture($"X: {x} Y: {y}");
|
||||||
|
renderer.DrawTexture(texture, wWidth - width, height, width, height);
|
||||||
|
SDL_DestroyTexture(texture);
|
||||||
|
SDL_FreeSurface(surfaceMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ public class TooltipRenderer : IRenderer
|
||||||
var tooltipX = (int)tooltipPosition.X;
|
var tooltipX = (int)tooltipPosition.X;
|
||||||
var tooltipY = (int)tooltipPosition.Y;
|
var tooltipY = (int)tooltipPosition.Y;
|
||||||
var (texture, width, height, surfaceMessage) = renderer.CreateTextTexture(tooltip);
|
var (texture, width, height, surfaceMessage) = renderer.CreateTextTexture(tooltip);
|
||||||
|
var tooltipWidth = Math.Min(300, width);
|
||||||
renderer.DrawTexture(
|
renderer.DrawTexture(
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX,
|
tooltipX,
|
||||||
|
|
@ -46,7 +47,7 @@ public class TooltipRenderer : IRenderer
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + 4 * uiScale,
|
tooltipX + 4 * uiScale,
|
||||||
tooltipY,
|
tooltipY,
|
||||||
width,
|
tooltipWidth,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
4,
|
4,
|
||||||
0,
|
0,
|
||||||
|
|
@ -56,7 +57,7 @@ public class TooltipRenderer : IRenderer
|
||||||
|
|
||||||
renderer.DrawTexture(
|
renderer.DrawTexture(
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + width + 4 * uiScale,
|
tooltipX + tooltipWidth + 4 * uiScale,
|
||||||
tooltipY,
|
tooltipY,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
|
|
@ -82,7 +83,7 @@ public class TooltipRenderer : IRenderer
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + 4 * uiScale,
|
tooltipX + 4 * uiScale,
|
||||||
tooltipY + 4 * uiScale,
|
tooltipY + 4 * uiScale,
|
||||||
width,
|
tooltipWidth,
|
||||||
height,
|
height,
|
||||||
4,
|
4,
|
||||||
4,
|
4,
|
||||||
|
|
@ -92,7 +93,7 @@ public class TooltipRenderer : IRenderer
|
||||||
|
|
||||||
renderer.DrawTexture(
|
renderer.DrawTexture(
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + width + 4 * uiScale,
|
tooltipX + tooltipWidth + 4 * uiScale,
|
||||||
tooltipY + 4 * uiScale,
|
tooltipY + 4 * uiScale,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
height,
|
height,
|
||||||
|
|
@ -118,7 +119,7 @@ public class TooltipRenderer : IRenderer
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + 4 * uiScale,
|
tooltipX + 4 * uiScale,
|
||||||
tooltipY + height + 4 * uiScale,
|
tooltipY + height + 4 * uiScale,
|
||||||
width,
|
tooltipWidth,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
4,
|
4,
|
||||||
5,
|
5,
|
||||||
|
|
@ -128,7 +129,7 @@ public class TooltipRenderer : IRenderer
|
||||||
|
|
||||||
renderer.DrawTexture(
|
renderer.DrawTexture(
|
||||||
this.tooltipTexture,
|
this.tooltipTexture,
|
||||||
tooltipX + width + 4 * uiScale,
|
tooltipX + tooltipWidth + 4 * uiScale,
|
||||||
tooltipY + height + 4 * uiScale,
|
tooltipY + height + 4 * uiScale,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
4 * uiScale,
|
4 * uiScale,
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ public class Player
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Vector2 Position { get; set; }
|
public Vector2 Position { get; set; }
|
||||||
|
public Vector2 PrettyPosition { get => (this.Position - new Vector2(512244, 5390)) / 16; }
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
public Vector2 Mining { get; set; }
|
public Vector2 Mining { get; set; }
|
||||||
public int MiningCooldown { get; set; }
|
public int MiningCooldown { get; set; }
|
||||||
|
|
|
||||||