Advertisement
AL4ST4I2

MainMenu.class

Oct 13th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.41 KB | None | 0 0
  1. package com.denis.main.TitleScreen;
  2.  
  3. import org.lwjgl.LWJGLException;
  4. import org.lwjgl.opengl.Display;
  5. import org.lwjgl.opengl.DisplayMode;
  6. import org.lwjgl.opengl.GL11;
  7.  
  8. public class TitleScreenMain {
  9.  
  10.  
  11.     public void MainMenu(String nomeMenu, int width, int height)
  12.     {
  13.  
  14.         initGL(nomeMenu, width, height);
  15.         // Init Oggetti:
  16.         Rettangolo playRect = new Rettangolo();
  17.         Rettangolo newRect = new Rettangolo();
  18.  
  19.         // Fine Init Oggetti.
  20.  
  21.  
  22.         while (!Display.isCloseRequested())
  23.         {
  24.             // rendering
  25.             GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
  26.             playRect.creaRettangolo(100, 100, 300, 100);
  27.             newRect.creaRettangolo(100, 300, 400, 100);
  28.  
  29.             // Fine Rendering.
  30.  
  31.  
  32.  
  33.             Display.update();
  34.             Display.sync(60);
  35.         }
  36.  
  37.         Display.destroy();
  38.     }
  39.  
  40.     public void initGL(String nomeMenu, int width, int height)
  41.     {
  42.         try
  43.         {
  44.             Display.setDisplayMode(new DisplayMode(width, height));
  45.             Display.setTitle(nomeMenu);
  46.             Display.create();
  47.         }
  48.         catch (LWJGLException e)
  49.         {
  50.             e.printStackTrace();
  51.         }
  52.         // Init OpenGL:
  53.         GL11.glMatrixMode(GL11.GL_PROJECTION);
  54.         GL11.glLoadIdentity();
  55.         GL11.glOrtho(0, 640, 480, 0, 1, -1);
  56.         GL11.glMatrixMode(GL11.GL_MODELVIEW);
  57.     }
  58.  
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement