當前位置: 首頁>>代碼示例>>Java>>正文


Java Colors類代碼示例

本文整理匯總了Java中itdelatrisu.opsu.ui.Colors的典型用法代碼示例。如果您正苦於以下問題:Java Colors類的具體用法?Java Colors怎麽用?Java Colors使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Colors類屬於itdelatrisu.opsu.ui包,在下文中一共展示了Colors類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: confirmExit

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
private boolean confirmExit() {
	if (System.currentTimeMillis() - exitconfirmation < 10000) {
		return true;
	}
	if (DownloadList.get().hasActiveDownloads()) {
		BubNotifListener.EVENT.make().onBubNotif(DownloadList.EXIT_CONFIRMATION, Colors.BUB_RED);
		exitRequested = false;
		exitconfirmation = System.currentTimeMillis();
		return false;
	}
	if (updater.getStatus() == Updater.Status.UPDATE_DOWNLOADING) {
		BubNotifListener.EVENT.make().onBubNotif(Updater.EXIT_CONFIRMATION, Colors.BUB_PURPLE);
		exitRequested = false;
		exitconfirmation = System.currentTimeMillis();
		return false;
	}
	return true;
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:19,代碼來源:DisplayContainer.java

示例2: draw

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
 * @param color the color filter
 * @param from index to draw from
 * @param to index to draw to (exclusive)
 */
public void draw(Color color, int from, int to) {
	if (curve == null)
		return;

	if (OPTION_FALLBACK_SLIDERS.state || SkinService.skin.getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
		// peppysliders
		Image hitCircle = GameImage.HITCIRCLE.getImage();
		Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
		for (int i = from; i < to; i++)
			hitCircleOverlay.drawCentered(curve[i].x, curve[i].y, Colors.WHITE_FADE);
		float a = fallbackSliderColor.a;
		fallbackSliderColor.a = color.a;
		for (int i = from; i < to; i++)
			hitCircle.drawCentered(curve[i].x, curve[i].y, fallbackSliderColor);
		fallbackSliderColor.a = a;
	} else {
		// mmsliders
		if (renderState == null)
			renderState = new CurveRenderState(hitObject, curve, false);
		renderState.draw(color, borderColor, from, to);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:29,代碼來源:Curve.java

示例3: create

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * Creates a new watch service instance (overwriting any previous instance),
 * registers the beatmap directory, and starts processing events.
 */
public static void create() {
	// close the existing watch service
	destroy();

	// create a new watch service
	try {
		ws = new BeatmapWatchService();
		ws.register(config.beatmapDir.toPath());
	} catch (IOException e) {
		Log.error("Could not create watch service", e);
		BubNotifListener.EVENT.make().onBubNotif("Could not create watch service", Colors.BUB_RED);
		return;
	}

	// start processing events
	ws.start();
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:22,代碼來源:BeatmapWatchService.java

示例4: draw

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
 * @param color the color filter
 * @param t set the curve interval to [0, t]
 */
public void draw(Color color, float t) {
	if (curve == null)
		return;

	t = Utils.clamp(t, 0f, 1f);

	// peppysliders
	if (Options.getSkin().getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
		int drawUpTo = (int) (curve.length * t);
		Image hitCircle = GameImage.HITCIRCLE.getImage();
		Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
		for (int i = 0; i < drawUpTo; i++)
			hitCircleOverlay.drawCentered(curve[i].x, curve[i].y, Colors.WHITE_FADE);
		for (int i = 0; i < drawUpTo; i++)
			hitCircle.drawCentered(curve[i].x, curve[i].y, color);
	}

	// mmsliders
	else {
		if (renderState == null)
			renderState = new CurveRenderState(hitObject, curve);
		renderState.draw(color, borderColor, t);
	}
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:30,代碼來源:Curve.java

示例5: createNewUser

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/** Creates a new user and switches to it. */
private void createNewUser() {
	SoundController.playSound(SoundEffect.MENUCLICK);
	String name = newUser.getName();
	int icon = newUser.getIconId();
	if (!UserList.get().isValidUserName(name)) {
		String error = name.isEmpty() ? "Enter a name for the user." : "You can't use that name.";
		UI.getNotificationManager().sendBarNotification(error);
		newUserButton.flash();
	} else {
		if (UserList.get().createNewUser(name, icon) == null)
			UI.getNotificationManager().sendBarNotification("Something wrong happened.");
		else {
			// change user
			UserList.get().changeUser(name);
			UI.getNotificationManager().sendNotification("New user created.\nEnjoy the game! :)", Colors.GREEN);
			listener.close(true);
		}
	}
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:21,代碼來源:UserSelectOverlay.java

示例6: revalidate

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
@Override
public void revalidate() {
	super.revalidate();

	btnAddLinear = new SimpleButton(displayContainer.width - 205, 50, 200, 25, Fonts.SMALL, "add linear", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAddQuadratic = new SimpleButton(displayContainer.width - 205, 80, 200, 25, Fonts.SMALL, "add quadratic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAddCubic = new SimpleButton(displayContainer.width - 205, 110, 200, 25, Fonts.SMALL, "add cubic", Colors.BLUE_BUTTON, Colors.WHITE_FADE, Colors.WHITE_FADE, Colors.ORANGE_BUTTON);
	btnAnimLin = new SimpleButton(displayContainer.width - 250, 50, 40, 25, Fonts.SMALL, "lin", Color.blue, Color.white, Color.white, Color.orange);
	btnAnimMid = new SimpleButton(displayContainer.width - 250, 80, 40, 25, Fonts.SMALL, "mid", Color.blue, Color.white, Color.white, Color.orange);
	btnAnimCub = new SimpleButton(displayContainer.width - 250, 110, 40, 25, Fonts.SMALL, "cub", Color.blue, Color.white, Color.white, Color.orange);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:12,代碼來源:MoveStoryboard.java

示例7: loadDirectory

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
private File loadDirectory(File dir, File defaultDir, String kind) {
	if (dir != null && dir.exists() && dir.isDirectory()) {
		return dir;
	}
	if (!defaultDir.isDirectory() && !defaultDir.mkdir()) {
		String msg = String.format("Failed to create %s directory at '%s'.", kind, defaultDir.getAbsolutePath());
		BubNotifListener.EVENT.make().onBubNotif(msg, Colors.BUB_RED);
	}
	return defaultDir;
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:11,代碼來源:Configuration.java

示例8: read

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
@Override
public void read(String s) {
	try {
		val = Utils.clamp(Integer.parseInt(s), min, max);
	} catch (Exception ignored) {
		BubNotifListener.EVENT.make().onBubNotif("Failed to parse " + configurationName + " option",
			Colors.BUB_RED);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:10,代碼來源:NumericOption.java

示例9: saveOptions

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
public void saveOptions() {
	try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
		new FileOutputStream(config.OPTIONS_FILE), "utf-8"))) {
		// header
		SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE, MMMM dd, yyyy");
		String date = dateFormat.format(new Date());
		writer.write("# opsu! configuration");
		writer.newLine();
		writer.write("# last updated on ");
		writer.write(date);
		writer.newLine();
		writer.newLine();

		// options
		for (Option option : optionMap.values()) {
			writer.write(option.configurationName);
			writer.write(" = ");
			writer.write(option.write());
			writer.newLine();
		}
		writer.close();
	} catch (IOException e) {
		String err = String.format("Failed to write to file '%s'.", config.OPTIONS_FILE.getAbsolutePath());
		Log.error(err, e);
		BubNotifListener.EVENT.make().onBubNotif(err, Colors.BUB_RED);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:28,代碼來源:OptionsService.java

示例10: renderHitCircle

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
public void renderHitCircle(float x, float y, Color color, int comboNumber, float comboNumberAlpha) {
	renderHitCircleOnly(x, y, color);
	boolean overlayAboveNumber = SkinService.skin.isHitCircleOverlayAboveNumber();
	if (!overlayAboveNumber) {
		renderHitCircleOverlayOnly(x, y, Colors.WHITE_FADE);
	}
	renderComboNumberOnly(x, y, comboNumber, comboNumberAlpha);
	if (overlayAboveNumber) {
		renderHitCircleOverlayOnly(x, y, Colors.WHITE_FADE);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:12,代碼來源:GameObjectRenderer.java

示例11: updateDisplayMode

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
public void updateDisplayMode(String resolutionString) {
	int screenWidth = nativeDisplayMode.getWidth();
	int screenHeight = nativeDisplayMode.getHeight();

	int eos = resolutionString.indexOf(' ');
	if (eos > -1) {
		resolutionString = resolutionString.substring(0, eos);
	}

	int width = screenWidth;
	int height = screenHeight;
	if (resolutionString.matches("^[0-9]+x[0-9]+$")) {
		String[] res = resolutionString.split("x");
		width = Integer.parseInt(res[0]);
		height = Integer.parseInt(res[1]);
	}

	// check for larger-than-screen dimensions
	if (!OPTION_ALLOW_LARGER_RESOLUTIONS.state && (screenWidth < width || screenHeight < height)) {
		width = 800;
		height = 600;
	}

	if (!OPTION_FULLSCREEN.state) {
		boolean borderless = (screenWidth == width && screenHeight == height);
		System.setProperty("org.lwjgl.opengl.Window.undecorated", Boolean.toString(borderless));
	}

	try {
		setDisplayMode(width, height, OPTION_FULLSCREEN.state);
	} catch (Exception e) {
		BubNotifListener.EVENT.make().onBubNotif("Failed to change resolution", Colors.BUB_RED);
		Log.error("Failed to set display mode.", e);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:36,代碼來源:DisplayContainer.java

示例12: unzip

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * Extracts the contents of a ZIP archive to a destination.
 * @param file the ZIP archive
 * @param dest the destination directory
 */
private void unzip(File file, File dest) {
	try {
		ZipFile zipFile = new ZipFile(file);
		zipFile.extractAll(dest.getAbsolutePath());
	} catch (ZipException e) {
		String err = String.format("Failed to unzip file %s to dest %s.", file.getAbsolutePath(), dest.getAbsolutePath());
		Log.error(err, e);
		BubNotifListener.EVENT.make().onBubNotif(err, Colors.BUB_RED);
	}
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:16,代碼來源:OszUnpacker.java

示例13: draw

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
@Override
public void draw(Graphics g, int trackPosition) {
	int timeDiff = hitObject.getTime() - trackPosition;
	final int approachTime = game.getApproachTime();
	final int fadeInTime = game.getFadeInTime();
	float scale = timeDiff / (float) approachTime;
	float approachScale = 1 + scale * 3;
	float fadeinScale = (timeDiff - approachTime + fadeInTime) / (float) fadeInTime;
	float alpha = Utils.clamp(1 - fadeinScale, 0, 1);

	if (GameMod.HIDDEN.isActive()) {
		final int hiddenDecayTime = game.getHiddenDecayTime();
		final int hiddenTimeDiff = game.getHiddenTimeDiff();
		if (fadeinScale <= 0f && timeDiff < hiddenTimeDiff + hiddenDecayTime) {
			float hiddenAlpha = (timeDiff < hiddenTimeDiff) ? 0f : (timeDiff - hiddenTimeDiff) / (float) hiddenDecayTime;
			alpha = Math.min(alpha, hiddenAlpha);
		}
	}

	float oldAlpha = Colors.WHITE_FADE.a;
	Colors.WHITE_FADE.a = color.a = alpha;

	if (timeDiff >= 0 && !GameMod.HIDDEN.isActive())
		GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
	GameImage.HITCIRCLE.getImage().drawCentered(x, y, color);
	boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber();
	if (!overlayAboveNumber)
		GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Colors.WHITE_FADE);
	data.drawSymbolNumber(hitObject.getComboNumber(), x, y,
			GameImage.HITCIRCLE.getImage().getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(), alpha);
	if (overlayAboveNumber)
		GameImage.HITCIRCLE_OVERLAY.getImage().drawCentered(x, y, Colors.WHITE_FADE);

	Colors.WHITE_FADE.a = oldAlpha;
}
 
開發者ID:itdelatrisu,項目名稱:opsu,代碼行數:36,代碼來源:Circle.java

示例14: takeScreenShot

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * @author http://wiki.lwjgl.org/index.php?title=Taking_Screen_Shots
 */
public void takeScreenShot() {
	// TODO: get a decent place for this
	// create the screenshot directory
	if (!screenshotDir.isDirectory() && !screenshotDir.mkdir()) {
		BubNotifListener.EVENT.make().onBubNotif(
			String.format( "Failed to create screenshot directory at '%s'.",
				screenshotDir.getAbsolutePath()), Colors.BUB_RED);
		return;
	}

	// create file name
	SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss");
	final String fileName = String.format("screenshot_%s.%s", date.format(new Date()), OPTION_SCREENSHOT_FORMAT.getValueString().toLowerCase());
	final File file = new File(screenshotDir, fileName);

	SoundController.playSound(SoundEffect.SHUTTER);

	// copy the screen to file
	final int width = Display.getWidth();
	final int height = Display.getHeight();
	final int bpp = 3;  // assuming a 32-bit display with a byte each for red, green, blue, and alpha
	final ByteBuffer buffer = BufferUtils.createByteBuffer(width * height * bpp);
	GL11.glReadBuffer(GL11.GL_FRONT);
	GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
	GL11.glReadPixels(0, 0, width, height, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, buffer);
	new Thread() {
		@Override
		public void run() {
			try {
				BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
				for (int x = 0; x < width; x++) {
					for (int y = 0; y < height; y++) {
						int i = (x + (width * y)) * bpp;
						int r = buffer.get(i) & 0xFF;
						int g = buffer.get(i + 1) & 0xFF;
						int b = buffer.get(i + 2) & 0xFF;
						image.setRGB(x, height - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b);
					}
				}
				ImageIO.write(image, OPTION_SCREENSHOT_FORMAT.getValueString().toLowerCase(), file);
				BubNotifListener.EVENT.make().onBubNotif("Created " + fileName,
					Colors.BUB_PURPLE);
			} catch (Exception e) {
				Log.error("Could not take screenshot", e);
				BubNotifListener.EVENT.make().onBubNotif(
					"Failed to take a screenshot. See log file for details",
					Colors.BUB_PURPLE);
			}
		}
	}.start();
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:55,代碼來源:Configuration.java

示例15: drawResult

import itdelatrisu.opsu.ui.Colors; //導入依賴的package包/類
/**
 * Draws the download result as a rectangular button.
 * @param g the graphics context
 * @param position the index (to offset the button from the topmost button)
 * @param hover true if the mouse is hovering over this button
 * @param focus true if the button is focused
 * @param previewing true if the beatmap is currently being previewed
 */
public void drawResult(Graphics g, float position, boolean hover, boolean focus, boolean previewing) {
	float textX = buttonBaseX + buttonWidth * 0.001f;
	float edgeX = buttonBaseX + buttonWidth * 0.985f;
	float y = buttonBaseY + position;
	float marginY = buttonHeight * 0.04f;
	Download dl = DownloadList.get().getDownload(beatmapSetID);

	// rectangle outline
	g.setColor((focus) ? Colors.BLACK_BG_FOCUS : (hover) ? Colors.BLACK_BG_HOVER : Colors.BLACK_BG_NORMAL);
	g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);

	// map is already loaded
	if (BeatmapSetList.get().containsBeatmapSetID(beatmapSetID)) {
		g.setColor(Colors.BLUE_BUTTON);
		g.fillRect(buttonBaseX, y, buttonWidth, buttonHeight);
	}

	// download progress
	if (dl != null) {
		float progress = dl.getProgress();
		if (progress > 0f) {
			g.setColor(Colors.GREEN);
			g.fillRect(buttonBaseX, y, buttonWidth * progress / 100f, buttonHeight);
		}
	}

	// preview button
	Image img = (previewing) ? GameImage.MUSIC_PAUSE.getImage() : GameImage.MUSIC_PLAY.getImage();
	img.drawCentered(textX + img.getWidth() / 2, y + buttonHeight / 2f);
	textX += img.getWidth() + buttonWidth * 0.001f;

	// text
	// TODO: if the title/artist line is too long, shorten it (e.g. add "...") instead of just clipping
	if (OPTION_SHOW_UNICODE.state) {
		Fonts.loadGlyphs(Fonts.BOLD, getTitle());
		Fonts.loadGlyphs(Fonts.BOLD, getArtist());
	}
	// TODO can't set clip again or else old clip will be cleared
	//g.setClip((int) textX, (int) (y + marginY), (int) (edgeX - textX - Fonts.DEFAULT.getWidth(creator)), Fonts.BOLD.getLineHeight());
	Fonts.BOLD.drawString(
			textX, y + marginY,
			String.format("%s - %s%s", getArtist(), getTitle(),
					(dl != null) ? String.format(" [%s]", dl.getStatus().getName()) : ""), Color.white);
	//g.clearClip();
	Fonts.DEFAULT.drawString(
			textX, y + marginY + Fonts.BOLD.getLineHeight(),
			String.format("Last updated: %s", date), Color.white);
	Fonts.DEFAULT.drawString(
			edgeX - Fonts.DEFAULT.getWidth(creator), y + marginY,
			creator, Color.white);
}
 
開發者ID:yugecin,項目名稱:opsu-dance,代碼行數:60,代碼來源:DownloadNode.java


注:本文中的itdelatrisu.opsu.ui.Colors類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。