package sillysagiri;

import javax.microedition.lcdui.Graphics;

import dothack.Global;

public final class Utils {
  public static void Clear_Screen(Graphics gg, int r, int g, int b)
  {
    gg.setColor(r,g,b);
    gg.fillRect(0, 0, Global.app.game.getWidth(), Global.app.game.getHeight());
  }

  public static void Clear_Screen(Graphics gg, int rgb)
  {
    gg.setColor(rgb);
    gg.fillRect(0, 0, Global.app.game.getWidth(), Global.app.game.getHeight());
  }

  public static int GetScreenWidth()
  {
    return Global.app.game.getWidth();
  }

  public static int GetScreenHeight()
  {
    return Global.app.game.getHeight();
  }

  public static int clamp(int value, int min, int max) {
    return Math.max(min, Math.min(value, max));
  }

  public static float clamp(float value, float min, float max) {
    return Math.max(min, Math.min(value, max));
  }

  public static double clamp(double value, double min, double max) {
    return Math.max(min, Math.min(value, max));
  }
}
