mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
UpdateF, dx reinit
This commit is contained in:
parent
fa2cb7ba56
commit
e87bf5b029
24 changed files with 1029 additions and 415 deletions
|
@ -11767,7 +11767,6 @@ namespace IDE
|
|||
public override void Init()
|
||||
{
|
||||
scope AutoBeefPerf("IDEApp.Init");
|
||||
|
||||
//int zag = 123;
|
||||
|
||||
if (mVerbosity == .Default)
|
||||
|
@ -14203,7 +14202,7 @@ namespace IDE
|
|||
//mDebugger.InitiateHotResolve(.ActiveMethods | .Allocations);
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
public override void Draw(bool forceDraw)
|
||||
{
|
||||
scope AutoBeefPerf("IDEApp.Draw");
|
||||
#if CLI
|
||||
|
@ -14213,7 +14212,7 @@ namespace IDE
|
|||
if (mBfResolveSystem != null)
|
||||
{
|
||||
mBfResolveSystem.PerfZoneStart("IDEApp.Draw");
|
||||
base.Draw();
|
||||
base.Draw(forceDraw);
|
||||
mBfResolveSystem.PerfZoneEnd();
|
||||
if (mBfResolveSystem.mIsTiming)
|
||||
{
|
||||
|
@ -14222,7 +14221,7 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
else
|
||||
base.Draw();
|
||||
base.Draw(forceDraw);
|
||||
}
|
||||
|
||||
public void DrawSquiggle(Graphics g, float x, float y, float width)
|
||||
|
|
|
@ -3,11 +3,15 @@ using Beefy.gfx;
|
|||
using System;
|
||||
using Beefy.events;
|
||||
using Beefy.widgets;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace IDE.ui
|
||||
{
|
||||
class AboutDialog : IDEDialog
|
||||
{
|
||||
static AboutDialog gAboutDialog;
|
||||
|
||||
const int cWidth = 320;
|
||||
const int cHeight = 240;
|
||||
const int cRandSize = 3777;
|
||||
|
@ -21,6 +25,14 @@ namespace IDE.ui
|
|||
uint8[cRandSize] mRand;
|
||||
int mRandIdx;
|
||||
|
||||
Stopwatch mStopwatch = new .()..Start() ~ delete _;
|
||||
struct Entry
|
||||
{
|
||||
public double mUpdateCntF;
|
||||
public float mTimeMS;
|
||||
}
|
||||
List<Entry> mEntries = new .() ~ delete _;
|
||||
|
||||
struct CColor
|
||||
{
|
||||
public uint8 r;
|
||||
|
@ -70,8 +82,24 @@ namespace IDE.ui
|
|||
Color colorOut = Color.ToNative(Color.Lerp(mainColors[(int)colorPos], mainColors[(int)colorPos + 1], colorPos - (int)colorPos));
|
||||
mPalette[i] = colorOut;
|
||||
}
|
||||
|
||||
/*mWindowFlags |= .Resizable;
|
||||
mWindowFlags &= ~.Modal;*/
|
||||
|
||||
gAboutDialog = this;
|
||||
}
|
||||
|
||||
|
||||
~this()
|
||||
{
|
||||
gAboutDialog = null;
|
||||
}
|
||||
|
||||
public override void AddedToParent()
|
||||
{
|
||||
base.AddedToParent();
|
||||
mWidgetWindow.mWantsUpdateF = true;
|
||||
}
|
||||
|
||||
public override void CalcSize()
|
||||
{
|
||||
mWidth = GS!(640);
|
||||
|
@ -140,12 +168,12 @@ namespace IDE.ui
|
|||
|
||||
mImage.SetBits(0, 0, cWidth, cHeight, cWidth, newBits);
|
||||
|
||||
float ang = Math.Min(mUpdateCnt * 0.006f, Math.PI_f / 2);
|
||||
float ang = Math.Min((float)(mUpdateCntF * 0.006f), Math.PI_f / 2);
|
||||
g.SetFont(mBigFont);
|
||||
g.DrawString("Beef IDE", 0, GS!(20) + (1.0f - Math.Sin(ang))*GS!(300), .Centered, mWidth);
|
||||
|
||||
float angMed = Math.Min(mUpdateCnt * 0.0055f, Math.PI_f / 2);
|
||||
float alpha = Math.Clamp(mUpdateCnt * 0.007f - 1.3f, 0, 1.0f);
|
||||
float angMed = Math.Min((float)(mUpdateCntF * 0.0055f), Math.PI_f / 2);
|
||||
float alpha = Math.Clamp((float)(mUpdateCntF * 0.007f) - 1.3f, 0, 1.0f);
|
||||
|
||||
using (g.PushColor(Color.Get(alpha)))
|
||||
{
|
||||
|
@ -164,6 +192,33 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
g.DrawQuad(mImage, 0, 0, 0.0f, 0.0f, mWidth, mHeight, 1.0f, 1.0f);
|
||||
|
||||
/*if (gAboutDialog == this)
|
||||
{
|
||||
/*Entry entry;
|
||||
entry.mTimeMS = mStopwatch.ElapsedMicroseconds / 1000.0f;
|
||||
entry.mUpdateCntF = mUpdateCntF;*/
|
||||
mEntries.Add(Entry() {mTimeMS = mStopwatch.ElapsedMicroseconds / 1000.0f, mUpdateCntF = mUpdateCntF});
|
||||
|
||||
if (mEntries.Count == 100)
|
||||
{
|
||||
float prevTime = 0;
|
||||
|
||||
for (var entry in mEntries)
|
||||
{
|
||||
Debug.WriteLine($"Entry Time:{entry.mTimeMS - prevTime:0.00} UpdateCntF:{entry.mUpdateCntF:0.00}");
|
||||
prevTime = entry.mTimeMS;
|
||||
|
||||
if (@entry.Index == 20)
|
||||
break;
|
||||
}
|
||||
|
||||
mEntries.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
using (g.PushColor(0xFFFFFFFF))
|
||||
g.FillRect(Math.Cos((float)(mUpdateCntF * 0.2f)) * 600 + mWidth / 2, 0, 8, mHeight);*/
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
|
@ -177,6 +232,12 @@ namespace IDE.ui
|
|||
DoFire();
|
||||
}
|
||||
|
||||
public override void UpdateF(float updatePct)
|
||||
{
|
||||
base.UpdateF(updatePct);
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
public override void KeyDown(KeyCode keyCode, bool isRepeat)
|
||||
{
|
||||
base.KeyDown(keyCode, isRepeat);
|
||||
|
|
|
@ -6508,7 +6508,7 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
public void UpdateCollapse()
|
||||
public void UpdateCollapse(float updatePct)
|
||||
{
|
||||
MarkDirty();
|
||||
|
||||
|
@ -6564,9 +6564,12 @@ namespace IDE.ui
|
|||
{
|
||||
if (emitEmbed.mIsOpen)
|
||||
{
|
||||
emitEmbed.mOpenPct = Math.Min(1.0f, emitEmbed.mOpenPct + 0.1f);
|
||||
emitEmbed.mOpenPct = Math.Min(1.0f, emitEmbed.mOpenPct + 0.1f * updatePct);
|
||||
if (emitEmbed.mOpenPct != 1.0f)
|
||||
{
|
||||
mCollapseNeedsUpdate = true;
|
||||
mWidgetWindow.mTempWantsUpdateF = true;
|
||||
}
|
||||
|
||||
if (emitEmbed.mView == null)
|
||||
{
|
||||
|
@ -6577,7 +6580,7 @@ namespace IDE.ui
|
|||
}
|
||||
else
|
||||
{
|
||||
emitEmbed.mOpenPct = Math.Max(0.0f, emitEmbed.mOpenPct - 0.1f);
|
||||
emitEmbed.mOpenPct = Math.Max(0.0f, emitEmbed.mOpenPct - 0.1f * updatePct);
|
||||
if (emitEmbed.mOpenPct == 0.0f)
|
||||
{
|
||||
if (emitEmbed.mView != null)
|
||||
|
@ -6587,7 +6590,10 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mCollapseNeedsUpdate = true;
|
||||
mWidgetWindow.mTempWantsUpdateF = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6664,13 +6670,14 @@ namespace IDE.ui
|
|||
var entry = mOrderedCollapseEntries[animIdx];
|
||||
if ((entry.mIsOpen) && (entry.mOpenPct < 1.0f))
|
||||
{
|
||||
entry.mOpenPct = Math.Min(entry.mOpenPct + animSpeed, 1.0f);
|
||||
entry.mOpenPct = Math.Min(entry.mOpenPct + animSpeed * updatePct, 1.0f);
|
||||
mWidgetWindow.mTempWantsUpdateF = true;
|
||||
}
|
||||
|
||||
if ((!entry.mIsOpen) && (entry.mOpenPct > 0))
|
||||
{
|
||||
entry.mOpenPct = Math.Max(entry.mOpenPct - animSpeed, 0.0f);
|
||||
|
||||
entry.mOpenPct = Math.Max(entry.mOpenPct - animSpeed * updatePct, 0.0f);
|
||||
mWidgetWindow.mTempWantsUpdateF = true;
|
||||
if (entry.mOpenPct == 0.0f)
|
||||
FinishCollapseClose(animIdx, entry);
|
||||
}
|
||||
|
|
|
@ -639,6 +639,7 @@ namespace IDE.ui
|
|||
mNavigationBar = new NavigationBar(this);
|
||||
AddWidget(mNavigationBar);
|
||||
}
|
||||
mAlwaysUpdateF = true;
|
||||
}
|
||||
public ~this()
|
||||
{
|
||||
|
@ -6811,13 +6812,19 @@ namespace IDE.ui
|
|||
|
||||
UpdateQueuedEmitShowData();
|
||||
|
||||
if (ewc.mCollapseNeedsUpdate)
|
||||
ewc.UpdateCollapse();
|
||||
|
||||
// Process after mQueuedCollapseData so mCharIdSpan is still valid
|
||||
ProcessDeferredResolveResults(0);
|
||||
}
|
||||
|
||||
public override void UpdateF(float updatePct)
|
||||
{
|
||||
base.UpdateF(updatePct);
|
||||
|
||||
var ewc = (SourceEditWidgetContent)mEditWidget.Content;
|
||||
if (ewc.mCollapseNeedsUpdate)
|
||||
ewc.UpdateCollapse(updatePct);
|
||||
}
|
||||
|
||||
public void UpdateQueuedEmitShowData()
|
||||
{
|
||||
var compiler = ResolveCompiler;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue