Skip to content

Commit

Permalink
Fix swap buffer & rendering skipped when there's no room
Browse files Browse the repository at this point in the history
This fix will allow the game state to have no room, and any GUIs which
have no room will still be rendered (and bg color will be colored
black). This should fix #160
  • Loading branch information
tzachshabtay committed Oct 4, 2017
1 parent dd79e76 commit 426fc4c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Source/Engine/AGS.Engine/Graphics/Logic/AGSRendererLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public class AGSRendererLoop : IRendererLoop

public bool Tick ()
{
if (_gameState.Room == null) return false;
IRoom room = _gameState.Room;
_glUtils.RefreshViewport(_game.Settings, _gameWindow, _gameState.Viewport);

switch (_roomTransitions.State)
var transitionState = _roomTransitions.State;
if (_gameState.Room == null) transitionState = RoomTransitionState.NotInTransition; //If there's no room, then room transition state is meaningless -> we'll interpret as not in transition, which will render the viewports, without a room (so GUIs will still be rendered).
switch (transitionState)
{
case RoomTransitionState.NotInTransition:
activateShader();
renderRoom();
renderAllViewports();
break;
case RoomTransitionState.BeforeLeavingRoom:
if (_roomTransitions.Transition == null)
Expand Down Expand Up @@ -121,12 +121,12 @@ private IFrameBuffer renderToBuffer()
TypedParameter sizeParam = new TypedParameter(typeof(Size), _game.Settings.WindowSize);
IFrameBuffer frameBuffer = _resolver.Container.Resolve<IFrameBuffer>(sizeParam);
frameBuffer.Begin();
renderRoom();
renderAllViewports();
frameBuffer.End();
return frameBuffer;
}

private void renderRoom()
private void renderAllViewports()
{
renderViewport(_gameState.Viewport);
try
Expand Down

0 comments on commit 426fc4c

Please sign in to comment.