Luninariel

289 - Renderer

Apr 8th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1. //
  2. //  Renderer.java
  3. //  Easel
  4. //
  5. //  Created by Philip Rhodes on 7/21/05.
  6. //  Copyright 2005 __MyCompanyName__. All rights reserved.
  7. //
  8. import java.awt.*;
  9. import java.awt.image.*;
  10. import javax.swing.*;
  11.  
  12. /** This is the parent class of all Renderers. Currently, it just
  13.   * holds a reference to a World object, but this will probably change.
  14.   * In addition to the abstract methods defined below, child classes must
  15.   * implement public void paintComponent(Graphics g)
  16.   */
  17. public abstract class Renderer extends JPanel {
  18.  
  19.    protected World world;
  20.    
  21.    /** Create a renderer to render the shapes in the specified World */
  22.    public Renderer(World w, boolean swingDoubleBuffered){
  23.    
  24.       super(swingDoubleBuffered);
  25.      
  26.       this.world = w;
  27.  
  28.    }
  29.    
  30.    /** We're hiding this constructor, because we don't need it.*/
  31.    protected Renderer(LayoutManager l){
  32.    
  33.    
  34.    }
  35.    
  36.    
  37.    /** Perform any initialization necessary. */
  38.    public void init(){}
  39.  
  40.    /** Render shapes in the World to 2D/*/
  41.    public abstract void render();
  42.    
  43.    /** Erase the drawing surface of the renderer*/
  44.    public abstract void clear();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment