How To Refresh The Screen

This beginner level how to explains how to refresh the SwinGame game window. Understanding how this function can be used will assist you in drawing exactly what you want to the game window when you want it.

howtorefreshthescreen

Level

Beginner

Read these first

About Graphics

Details


In SwinGame you can draw primitive shapes, images and sprites to the screen. Once an image, shape or sprite has been loaded into the game the screen must be refreshed before it is visible. To gain a more in-depth understanding read the All About Graphics




Source Code Widget

  • program HowToRefreshTheScreen;
    uses
        SwinGame, sgTypes;    
    
    procedure Main();
    begin
        OpenGraphicsWindow('How To Draw Something To The Screen', 320, 240); 
        LoadDefaultColors();
      
        ClearScreen();    // clear the background canvas (black by default)
        RefreshScreen();  // make it appear on screen...
        Delay(2000);      // wait for 2 seconds  
      
        ClearScreen(ColorYellow);   // clear the background canvas
        RefreshScreen();            // make it appear on screen...
      
        //Start drawing the "next" screen to appear...
        ClearScreen(ColorWhite);    // clear the background canvas
      
        Delay(2000);                // wait for 2 seconds... notice the yellow screen!
        RefreshScreen();            // make the white screen appear...
      
        Delay(2000);
      
        ReleaseAllResources();
    end;
    
    begin
        Main();
    end.
  • Source Code Coming Soon

  • Source Code Coming Soon

  • Source Code Coming Soon

  • Source Code Coming Soon

Without the delay the window would appear quickly, but then disappear before you can see what it did!

Possibilities