Make Y+ up. (#109)

This commit is contained in:
Pieter-Jan Briers
2018-09-17 10:46:38 +02:00
committed by GitHub
parent 7a91fb7512
commit 2dd3f24fb2
7 changed files with 496 additions and 501 deletions

View File

@@ -27,16 +27,7 @@ namespace Content.Client.Construction
{ {
if (Prototype != null) if (Prototype != null)
{ {
// Stupid god damn Y AXIS.
var dir = Manager.Direction; var dir = Manager.Direction;
if (dir == Direction.South)
{
dir = Direction.North;
}
else if (dir == Direction.North)
{
dir = Direction.South;
}
Owner.SpawnGhost(Prototype, coords, dir); Owner.SpawnGhost(Prototype, coords, dir);
} }
return true; return true;

View File

@@ -56,16 +56,14 @@ namespace Content.Client.GameObjects.Components.SmoothWalling
var state0 = $"{StateBase}0"; var state0 = $"{StateBase}0";
SnapGrid = Owner.GetComponent<SnapGridComponent>(); SnapGrid = Owner.GetComponent<SnapGridComponent>();
Sprite = Owner.GetComponent<ISpriteComponent>(); Sprite = Owner.GetComponent<ISpriteComponent>();
// BIG NOTE: Y axis is fucked. Double fucked. Triple super-mega-ultra-turbo-fucked.
// so, the DirectionOffsets here are incorrect (flipped).
Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0)); Sprite.LayerMapSet(CornerLayers.SE, Sprite.AddLayerState(state0));
Sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.Flip); Sprite.LayerSetDirOffset(CornerLayers.SE, DirectionOffset.None);
Sprite.LayerMapSet(CornerLayers.NE, Sprite.AddLayerState(state0)); Sprite.LayerMapSet(CornerLayers.NE, Sprite.AddLayerState(state0));
Sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.Clockwise); Sprite.LayerSetDirOffset(CornerLayers.NE, DirectionOffset.CounterClockwise);
Sprite.LayerMapSet(CornerLayers.NW, Sprite.AddLayerState(state0)); Sprite.LayerMapSet(CornerLayers.NW, Sprite.AddLayerState(state0));
Sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.None); Sprite.LayerSetDirOffset(CornerLayers.NW, DirectionOffset.Flip);
Sprite.LayerMapSet(CornerLayers.SW, Sprite.AddLayerState(state0)); Sprite.LayerMapSet(CornerLayers.SW, Sprite.AddLayerState(state0));
Sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.CounterClockwise); Sprite.LayerSetDirOffset(CornerLayers.SW, DirectionOffset.Clockwise);
} }
public override void ExposeData(ObjectSerializer serializer) public override void ExposeData(ObjectSerializer serializer)

View File

@@ -32,8 +32,8 @@ namespace Content.Client.UserInterface
private UiHandInfo LeftHand; private UiHandInfo LeftHand;
private UiHandInfo RightHand; private UiHandInfo RightHand;
private Box2i handL; private UIBox2i handL;
private Box2i handR; private UIBox2i handR;
protected override void Initialize() protected override void Initialize()
{ {
@@ -53,7 +53,7 @@ namespace Content.Client.UserInterface
SetMarginsPreset(LayoutPreset.CenterBottom); SetMarginsPreset(LayoutPreset.CenterBottom);
SetAnchorPreset(LayoutPreset.CenterBottom); SetAnchorPreset(LayoutPreset.CenterBottom);
handL = new Box2i(0, 0, BOX_SIZE, BOX_SIZE); handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE);
handR = handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0)); handR = handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0));
SS14.Shared.Log.Logger.Debug($"{handL}, {handR}"); SS14.Shared.Log.Logger.Debug($"{handL}, {handR}");
MouseFilter = MouseFilterMode.Stop; MouseFilter = MouseFilterMode.Stop;
@@ -64,7 +64,7 @@ namespace Content.Client.UserInterface
return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE); return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE);
} }
protected override void Draw(DrawingHandle handle) protected override void Draw(DrawingHandleScreen handle)
{ {
if (!TryGetHands(out IHandsComponent hands)) if (!TryGetHands(out IHandsComponent hands))
return; return;
@@ -79,7 +79,7 @@ namespace Content.Client.UserInterface
{ {
var bounds = LeftHand.HeldSprite.Size; var bounds = LeftHand.HeldSprite.Size;
handle.DrawTextureRect(LeftHand.HeldSprite, handle.DrawTextureRect(LeftHand.HeldSprite,
Box2i.FromDimensions(handL.Left + (int)(handL.Width / 2f - bounds.X / 2f), UIBox2i.FromDimensions(handL.Left + (int)(handL.Width / 2f - bounds.X / 2f),
handL.Top + (int)(handL.Height / 2f - bounds.Y / 2f), handL.Top + (int)(handL.Height / 2f - bounds.Y / 2f),
(int)bounds.X, (int)bounds.Y), tile: false); (int)bounds.X, (int)bounds.Y), tile: false);
} }
@@ -88,7 +88,7 @@ namespace Content.Client.UserInterface
{ {
var bounds = RightHand.HeldSprite.Size; var bounds = RightHand.HeldSprite.Size;
handle.DrawTextureRect(RightHand.HeldSprite, handle.DrawTextureRect(RightHand.HeldSprite,
Box2i.FromDimensions(handR.Left + (int)(handR.Width / 2f - bounds.Y / 2f), UIBox2i.FromDimensions(handR.Left + (int)(handR.Width / 2f - bounds.Y / 2f),
handR.Top + (int)(handR.Height / 2f - bounds.Y / 2f), handR.Top + (int)(handR.Height / 2f - bounds.Y / 2f),
(int)bounds.X, (int)bounds.Y), tile: false); (int)bounds.X, (int)bounds.Y), tile: false);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -12,7 +12,7 @@
texture: Objects/door_ew.png texture: Objects/door_ew.png
- type: BoundingBox - type: BoundingBox
aabb: "1,-0.75,2,0.75" aabb: "-2,-0.75,-1,0.75"
sizeX: 1.9 sizeX: 1.9
offsetY: 1.5 offsetY: 1.5
- type: Collidable - type: Collidable

View File

@@ -22,7 +22,7 @@
state: greyshirt state: greyshirt
- type: BoundingBox - type: BoundingBox
aabb: "0.15,-0.45,1.05,0.45" aabb: "-1,-0.45,-0.15,0.45"
- type: Physics - type: Physics
mass: 5 mass: 5

2
engine

Submodule engine updated: 523e4d8c49...796626b7d8