1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

use the new system in panel

This commit is contained in:
Ellpeck 2020-04-02 17:54:10 +02:00
parent 5a8e74c5f3
commit cc06b827ff

View file

@ -147,18 +147,18 @@ namespace MLEM.Ui.Elements {
this.UpdateAreaIfDirty(); this.UpdateAreaIfDirty();
if (this.scrollOverflow && this.renderTarget != null) { if (this.scrollOverflow && this.renderTarget != null) {
// draw children onto the render target // draw children onto the render target
batch.GraphicsDevice.SetRenderTarget(this.renderTarget); using (batch.GraphicsDevice.WithRenderTarget(this.renderTarget)) {
batch.GraphicsDevice.Clear(Color.Transparent); batch.GraphicsDevice.Clear(Color.Transparent);
// offset children by the render target's location // offset children by the render target's location
var area = this.GetRenderTargetArea(); var area = this.GetRenderTargetArea();
var trans = Matrix.CreateTranslation(-area.X, -area.Y, 0); var trans = Matrix.CreateTranslation(-area.X, -area.Y, 0);
// do the usual draw, but within the render target // do the usual draw, but within the render target
batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, null, null, null, trans); batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, null, null, null, trans);
base.Draw(time, batch, alpha, blendState, samplerState, trans); base.Draw(time, batch, alpha, blendState, samplerState, trans);
batch.End(); batch.End();
// also draw any children early within the render target with the translation applied // also draw any children early within the render target with the translation applied
base.DrawEarly(time, batch, alpha, blendState, samplerState, trans); base.DrawEarly(time, batch, alpha, blendState, samplerState, trans);
batch.GraphicsDevice.SetRenderTarget(null); }
} else { } else {
base.DrawEarly(time, batch, alpha, blendState, samplerState, matrix); base.DrawEarly(time, batch, alpha, blendState, samplerState, matrix);
} }