当前位置: 首页>>代码示例>>Java>>正文


Java ColorEffect类代码示例

本文整理汇总了Java中org.newdawn.slick.font.effects.ColorEffect的典型用法代码示例。如果您正苦于以下问题:Java ColorEffect类的具体用法?Java ColorEffect怎么用?Java ColorEffect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ColorEffect类属于org.newdawn.slick.font.effects包,在下文中一共展示了ColorEffect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
/**
	 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
	 */
	public void init(GameContainer container) throws SlickException {
		container.setShowFPS(false);

		// unicodeFont = new UnicodeFont(Font.decode("Arial Unicode MS"), 25, false, false);
		unicodeFont = new UnicodeFont("c:/windows/fonts/arial.ttf", 48, false, false);
//		unicodeFont.setPaddingBottom(10);
//		unicodeFont.setPaddingRight(10);
//		unicodeFont.setPaddingAdvanceX(-10);
//		unicodeFont.getEffects().add(new ShadowEffect(java.awt.Color.black, 5, 5, 0.5f));
		unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));

		// unicodeFont = new UnicodeFont("Arial", 25, false, false);
		// unicodeFont = new UnicodeFont("Everson Mono", 44, false, false);

		// font.addGlyphs(0, 255);
		// font.addGlyphs("[email protected]#$%^&*()");

		container.getGraphics().setBackground(Color.darkGray);
	}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:23,代码来源:UnicodeFontTest.java

示例2: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
/**
	 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
	 */
	public void init(GameContainer container) throws SlickException {
		container.setShowFPS(false);

		// unicodeFont = new UnicodeFont(Font.decode("Arial Unicode MS"), 25, false, false);
		unicodeFont = new UnicodeFont("testdata/font.ttf", 48, false, false);
//		unicodeFont.setPaddingBottom(10);
//		unicodeFont.setPaddingRight(10);
//		unicodeFont.setPaddingAdvanceX(-10);
//		unicodeFont.getEffects().add(new ShadowEffect(java.awt.Color.black, 5, 5, 0.5f));
		unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));
        unicodeFont.setDisplayListCaching(true);
		// unicodeFont = new UnicodeFont("Arial", 25, false, false);
		// unicodeFont = new UnicodeFont("Everson Mono", 44, false, false);

		// font.addGlyphs(0, 255);
		// font.addGlyphs("[email protected]#$%^&*()");

		container.getGraphics().setBackground(Color.darkGray);
	}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:UnicodeFontTest.java

示例3: addFont

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void addFont(String key, String file, int size, boolean bold, boolean italic, Effect [] effects) throws SlickException {
	try {
		AssetManager.ASSETS_TO_LOAD++;
		
		UnicodeFont uni = new UnicodeFont(file, size, bold, italic);
		uni.addAsciiGlyphs();
		uni.addGlyphs(400, 600);
		uni.getEffects().add(new ColorEffect(Color.WHITE));
		uni.getEffects().addAll(Arrays.asList(effects));
		uni.loadGlyphs();
		if((fonts != null) && (uni != null)) {
			fonts.put(key, uni);
			
			AssetManager.ASSETS_LOADED++;
			System.out.println(String.format("Font Loaded: %s", key));
		}
	} catch(Exception ex) {
		ex.printStackTrace();
		System.out.printf("ERROR: Font \"%s\" could not be loaded!\n", file);
	}
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:23,代码来源:AssetManager.java

示例4: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
/**
 * Initializes all fonts.
 * @throws SlickException if ASCII glyphs could not be loaded
 * @throws FontFormatException if any font stream data does not contain the required font tables
 * @throws IOException if a font stream cannot be completely read
 */
public static void init() throws SlickException, FontFormatException, IOException {
	float fontBase = 12f * GameImage.getUIscale();
	Font javaFont = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Constants.FONT_NAME));
	Font font = javaFont.deriveFont(Font.PLAIN, (int) (fontBase * 4 / 3));
	DEFAULT = new UnicodeFont(font);
	BOLD = new UnicodeFont(font.deriveFont(Font.BOLD));
	XLARGE = new UnicodeFont(font.deriveFont(fontBase * 3));
	LARGE = new UnicodeFont(font.deriveFont(fontBase * 2));
	MEDIUM = new UnicodeFont(font.deriveFont(fontBase * 3 / 2));
	MEDIUMBOLD = new UnicodeFont(font.deriveFont(Font.BOLD, fontBase * 3 / 2));
	SMALL = new UnicodeFont(font.deriveFont(fontBase));
	SMALLBOLD = new UnicodeFont(font.deriveFont(Font.BOLD, fontBase));
	ColorEffect colorEffect = new ColorEffect();
	loadFont(DEFAULT, colorEffect);
	loadFont(BOLD, colorEffect);
	loadFont(XLARGE, colorEffect);
	loadFont(LARGE, colorEffect);
	loadFont(MEDIUM, colorEffect);
	loadFont(MEDIUMBOLD, colorEffect);
	loadFont(SMALL, colorEffect);
	loadFont(SMALLBOLD, colorEffect);
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:29,代码来源:Fonts.java

示例5: UnicodeFontRenderer

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public UnicodeFontRenderer(Font awtFont) {
    super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"),
            Minecraft.getMinecraft().getTextureManager(), false);

    font = new UnicodeFont(awtFont);
    font.addAsciiGlyphs();
    font.getEffects().add(new ColorEffect(Color.WHITE));
    try {
        font.loadGlyphs();
    } catch (SlickException exception) {
        throw new RuntimeException(exception);
    }
    String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
    FONT_HEIGHT = font.getHeight(alphabet) / 4;
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:17,代码来源:UnicodeFontRenderer.java

示例6: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
	missing = new Image("res/imgs/units/missing.png");
	loading = new String[18];
	f = sd.getFont();
	f = f.deriveFont(Font.PLAIN, gc.getScreenHeight() / loading.length - 5);
	UnicodeFont uf = new UnicodeFont(f);
	uf.getEffects().add(new ColorEffect(java.awt.Color.white));
	uf.addAsciiGlyphs();
	uf.loadGlyphs();

	panel = new Panel(0, 0, gc.getWidth(), gc.getHeight());
	labels = new Label[loading.length];
	for (int i = 0; i < labels.length; i++) {
		labels[i] = new Label(0, i * (gc.getScreenHeight() / loading.length - 5), uf);
		panel.add(labels[i]);
	}

	mapd = sd.getMap();

	units = new Image[1025][4];
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:24,代码来源:GameLoading.java

示例7: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
/**
	 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
	 */
	public void init(GameContainer container) throws SlickException {
		container.setShowFPS(false);

		// unicodeFont = new UnicodeFont(Font.decode("Arial Unicode MS"), 25, false, false);
		unicodeFont = new UnicodeFont("testdata/Lato-Thin.ttf", 48, false, false);
//		unicodeFont.setPaddingBottom(10);
//		unicodeFont.setPaddingRight(10);
//		unicodeFont.setPaddingAdvanceX(-10);
//		unicodeFont.getEffects().add(new ShadowEffect(java.awt.Color.black, 5, 5, 0.5f));
		unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.white));

		// unicodeFont = new UnicodeFont("Arial", 25, false, false);
		// unicodeFont = new UnicodeFont("Everson Mono", 44, false, false);

		// font.addGlyphs(0, 255);
		// font.addGlyphs("[email protected]#$%^&*()");

		container.getGraphics().setBackground(Color.darkGray);
	}
 
开发者ID:nguillaumin,项目名称:slick2d-maven,代码行数:23,代码来源:UnicodeFontTest.java

示例8: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {

        Image imagesBG[] = new Image[]{
                new Image("Assets/Graphics/Game Over/Frames/GO0000.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0001.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0002.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0003.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0004.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0005.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0006.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0007.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0008.png"),
                new Image("Assets/Graphics/Game Over/Frames/GO0009.png"),
        };

        coordsIndicator = new Coordinate[]{
                new Coordinate(537, 595),
                new Coordinate(537, 680),
        };

        animateBG = new Animation(imagesBG, 200);

        fontStats = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 24, false, false);
        fontStats.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontStats.addAsciiGlyphs();
        fontStats.loadGlyphs();

        fontWinningPlayer = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 32, false, false);
        fontWinningPlayer.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontWinningPlayer.addAsciiGlyphs();
        fontWinningPlayer.loadGlyphs();


        try {
            scoreTallySFX = AudioLoader.getAudio("OGG", ResourceLoader.getResourceAsStream("Assets/Sound Effects/Score Tally SFX.ogg"));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
 
开发者ID:earlmalaki,项目名称:BeatBitBeat,代码行数:41,代码来源:GameOverState.java

示例9: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {

        fontCombo = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 48, false, false);
        fontCombo.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontCombo.addAsciiGlyphs();
        fontCombo.loadGlyphs();

        fontTime = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 34, false, false);
        fontTime.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontTime.addAsciiGlyphs();
        fontTime.loadGlyphs();

        fontResources = new UnicodeFont("Assets/Fonts/Disposable Droid/DisposableDroidBB.ttf", 20, false, false);
        fontResources.getEffects().add(new ColorEffect(java.awt.Color.white));
        fontResources.addAsciiGlyphs();
        fontResources.loadGlyphs();

        imageBG = new Image("Assets/Graphics/Game Proper/Game Proper BG.png");

        imagesNotes = new Image[]{
                new Image("Assets/Graphics/Game Proper/Note Red.png"),
                new Image("Assets/Graphics/Game Proper/Note Green.png"),
                new Image("Assets/Graphics/Game Proper/Note Blue.png"),
                new Image("Assets/Graphics/Game Proper/Note Yellow.png")
        };

        imagesPressedHitbox = new Image[]{
                new Image("Assets/Graphics/Game Proper/Pressed Hitbox Red.png"),
                new Image("Assets/Graphics/Game Proper/Pressed Hitbox Green.png"),
                new Image("Assets/Graphics/Game Proper/Pressed Hitbox Blue.png"),
                new Image("Assets/Graphics/Game Proper/Pressed Hitbox Yellow.png")
        };

    }
 
开发者ID:earlmalaki,项目名称:BeatBitBeat,代码行数:35,代码来源:GameProperState.java

示例10: UnicodeFontRenderer

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public UnicodeFontRenderer(Font awtFont) {
	super(Minecraft.getMinecraft().gameSettings, new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().getTextureManager(), false);

	font = new UnicodeFont(awtFont);
	font.addAsciiGlyphs();
	font.getEffects().add(new ColorEffect(Color.WHITE));
	try {
		font.loadGlyphs();
	} catch(SlickException exception) {
		throw new RuntimeException(exception);
	}
	String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
	FONT_HEIGHT = font.getHeight(alphabet) / 2;
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:16,代码来源:UnicodeFontRenderer.java

示例11: loadFonts

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked") //loads the fonts for the game including different font sizes.
public static void loadFonts() {
	int arrayLength = GameConstants.GAME_FONT.length;
	try {
		for(int i = 0; i < arrayLength; i++) {
			UnicodeFont font = new UnicodeFont(FONT_LOCATION, (int) ((16+10*i)/GameConstants.WINDOW_SCALE), false, false);
			font.addAsciiGlyphs();
			font.getEffects().add(new ColorEffect());
			font.loadGlyphs();
			GameConstants.GAME_FONT[i] = font;
		}
	} catch(Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:thetorine,项目名称:sdd-major,代码行数:16,代码来源:IngameState.java

示例12: loadFonts

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
private static void loadFonts() {
    font = new UnicodeFont(new java.awt.Font("Times New Roman", java.awt.Font.PLAIN, 24));
    font.getEffects().add(new ColorEffect(java.awt.Color.white));
    font.addAsciiGlyphs();
    try { font.loadGlyphs(); }
    catch (SlickException e) {
        e.printStackTrace();
    }
}
 
开发者ID:TimboKZ,项目名称:ActiveVisualiser,代码行数:10,代码来源:Core.java

示例13: init

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
	this.game = game;
	Font font = new Font(Font.MONOSPACED, Font.PLAIN, 60);
	ufont = new UnicodeFont(font);
	ufont.addAsciiGlyphs();
	ufont.addGlyphs(32, 127);
	ufont.getEffects().add(new ColorEffect(Color.WHITE));
	ufont.loadGlyphs();
}
 
开发者ID:Jullekungfu,项目名称:SpaceDefence,代码行数:12,代码来源:MainMenu.java

示例14: TTFRenderer

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
public TTFRenderer(String fontName, int fontType, int size, float kerning) {
	this.fontName = fontName;
	this.fontType = fontType;
	this.size = size;
	
	this.unicodeFont = new UnicodeFont(new Font(fontName, fontType, size));
    this.kerning = kerning;
   
	this.unicodeFont.addAsciiGlyphs();
    this.unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
    
    try {
        this.unicodeFont.loadGlyphs();
    } catch(Exception e) {
        e.printStackTrace();
    }
       
    for(int i = 0; i < 32; i++) {
        int shadow = (i >> 3 & 1) * 85;
        int red = (i >> 2 & 1) * 170 + shadow;
        int green = (i >> 1 & 1) * 170 + shadow;
        int blue = (i >> 0 & 1) * 170 + shadow;

        if(i == 6) {
            red += 85;
        }

        if(i >= 16) {
            red /= 4;
            green /= 4;
            blue /= 4;
        }

        this.colorCodes[i] = (red & 255) << 16 | (green & 255) << 8 | blue & 255;
    }
    
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:38,代码来源:TTFRenderer.java

示例15: entered

import org.newdawn.slick.font.effects.ColorEffect; //导入依赖的package包/类
@Override
public void entered() {
    java.awt.Font awtFont = new java.awt.Font("Arial", java.awt.Font.PLAIN, 24);
    font = new UnicodeFont(awtFont);
    font.getEffects().add(new ColorEffect(java.awt.Color.RED));
    font.addAsciiGlyphs();
    font.loadGlyphs();
}
 
开发者ID:FOShameDotOrg,项目名称:fuzzy-octo-shame,代码行数:9,代码来源:MenuState.java


注:本文中的org.newdawn.slick.font.effects.ColorEffect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。