Exemplo n.º 1
0
  public void update() {
    Display.update();
    Display.sync(fps);
    detectKonami();

    if (Constants.allowFullScr) {
      if ((fullScr && !Display.isFullscreen()) || (!fullScr && Display.isFullscreen())) {
        System.out.println("Performing Display.destroy()/create() cycle");
        sM = Display.getDisplayMode();
        Display.destroy();
        try {
          //					DisplayMode[] d = Display.getAvailableDisplayModes();
          //					int value = 0;
          //					int index = 0;
          //					for(int i = 0; i < d.length; i++){
          //						if(d[i].getWidth() > value){
          //							value = d[i].getWidth();
          //							index = i;
          //						}
          //					}
          Display.setDisplayMode(sM);
          Display.setTitle("Music Dots");
          Display.setFullscreen(fullScr);
          Display.create();
          Display.setVSyncEnabled(true);
          Constants.VIEW_HEIGHT = sM.getHeight();
          Constants.VIEW_WIDTH = sM.getWidth();
          setupOpenGl();
          Fonts.initialize();
        } catch (LWJGLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    }

    Theme.setClearColor();

    // TODO: we should be calling a "recreateView" function and call this in there. Not sure why
    // we're recreating the view in an update function.
    if (!bPlayerModelInitialized) {
      StaticDrawer.initializeTextures();
      bPlayerModelInitialized = true;
    }

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  }
Exemplo n.º 2
0
  /** Uses the next clear value array in our list */
  public static void nextClearColor() {
    clearListNum++;
    if (clearListNum >= clearList.size()) clearListNum = 0;

    currentTheme.clearColor = clearList.get(clearListNum);
  }
Exemplo n.º 3
0
  public static void initialize() {
    // GLOW THEME
    GLOW_THEME.srcBlendFactor = GL_SRC_ALPHA;
    GLOW_THEME.dstBlendFactor = GL_ONE;
    GLOW_THEME.color = Color.white;
    GLOW_THEME.clearColor = new float[] {0.0f, 0.0f, 0.0f, 1.0f};

    // FLAT CIRCLE THEME
    FLAT_COLOR.srcBlendFactor = GL_SRC_ALPHA;
    FLAT_COLOR.dstBlendFactor = GL_SRC_COLOR;
    FLAT_COLOR.color = Color.white;
    FLAT_COLOR.clearColor = new float[] {0.0f, 0.0f, 0.0f, 1.0f};

    // SQUARE THEME
    SQUARE_THEME.srcBlendFactor = GL_SRC_ALPHA;
    SQUARE_THEME.dstBlendFactor = GL_ONE;
    SQUARE_THEME.color = Color.white;
    SQUARE_THEME.clearColor = new float[] {0.0f, 0.0f, 0.0f, 1.0f};

    float fColorOffset = 0.2f;
    clearList.add(new float[] {0.0f, 0.0f, 0.0f, 1.0f}); // BLACK
    clearList.add(new float[] {fColorOffset, fColorOffset, fColorOffset, 1.0f}); // WHITE
    clearList.add(new float[] {fColorOffset, 0.0f, 0.0f, 1.0f}); // RED
    clearList.add(new float[] {fColorOffset, fColorOffset, 0.0f, 1.0f}); // YELLOW
    clearList.add(new float[] {0.0f, fColorOffset, 0.0f, 1.0f}); // GREEN
    clearList.add(new float[] {0.0f, 0.0f, fColorOffset, 1.0f}); // BLUE

    themeList.add(GLOW_THEME);
    themeList.add(SQUARE_THEME);

    // pulling out the flat color theme as only radiosity and square themes will be used
    // themeList.add(FLAT_COLOR);
  }