Skip to content

Commit

Permalink
Fixup chibi placement and BG crop/resize on dual screen (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonko0493 authored Jun 22, 2023
1 parent 1b46047 commit a17a705
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/SerialLoops/Dialogs/BackgroundCropResizeDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ImageCropResizeDialog(SKBitmap startImage, int width, int height, ILogger
{
_log = log;
Title = "Crop & Scale";
MinimumSize = new(900, 650);
MinimumSize = new(900, 750);
Padding = 10;
StartImage = startImage;
FinalImage = new(width, height);
Expand All @@ -55,7 +55,7 @@ private void InitializeComponent()
};

// Preview
_preview = new SKBitmap(650, 500);
_preview = new SKBitmap(650, 600);
_previewLayout = new() { Padding = 10 };
_previewLayout.Invalidate();

Expand Down
25 changes: 21 additions & 4 deletions src/SerialLoops/Editors/ScriptEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,15 @@ private void UpdatePreview()
}
for (int i = 0; i < commands.Count; i++)
{
if (commands[i].Verb == CommandVerb.OP_MODE)
{
// Kyon auto-added by OP_MODE command
ChibiItem chibi = ((ChibiItem)_project.Items.First(i => i.Type == ItemDescription.ItemType.Chibi && ((ChibiItem)i).ChibiIndex == 1));
if (!chibis.Contains(chibi))
{
chibis.Add(chibi);
}
}
if (commands[i].Verb == CommandVerb.CHIBI_ENTEREXIT)
{
if (((ChibiEnterExitScriptParameter)commands[i].Parameters[1]).Mode == ChibiEnterExitScriptParameter.ChibiEnterExitType.ENTER)
Expand Down Expand Up @@ -1630,14 +1639,14 @@ private void UpdatePreview()
}

int chibiStartX, chibiY;
if (commands.Any(c => c.Verb == EventFile.CommandVerb.OP_MODE))
if (commands.Any(c => c.Verb == CommandVerb.OP_MODE))
{
chibiStartX = 100;
chibiY = 50;
}
else
{
chibiStartX = 44;
chibiStartX = 80;
chibiY = 100;
}
int chibiCurrentX = chibiStartX;
Expand All @@ -1646,8 +1655,16 @@ private void UpdatePreview()
{
SKBitmap chibiFrame = chibi.ChibiAnimations.First().Value.ElementAt(0).Frame;
canvas.DrawBitmap(chibiFrame, new SKPoint(chibiCurrentX, chibiY));
chibiWidth = chibiFrame.Width - 10;
chibiCurrentX += chibiWidth;
chibiWidth = chibiFrame.Width - 16;
if (chibiY == 50)
{
chibiY = 100;
chibiCurrentX = 80;
}
else
{
chibiCurrentX += chibiWidth;
}
}

// Draw top screen chibi emotes
Expand Down

0 comments on commit a17a705

Please sign in to comment.