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


Java Sys.alert方法代码示例

本文整理汇总了Java中org.lwjgl.Sys.alert方法的典型用法代码示例。如果您正苦于以下问题:Java Sys.alert方法的具体用法?Java Sys.alert怎么用?Java Sys.alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.Sys的用法示例。


在下文中一共展示了Sys.alert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: disconnectGame

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Disconnect from game. 
 * Allows for resetting server and client if triggered, but is not used in all situations.
 *
 * @param message the message
 */
public static void disconnectGame(String message){
	/*
	//wouldn't be hard to use something like this to reset to lobby rather than quit the game:
	//at the moment this disconnect is only in a few places between stages, i.e. while waiting
	//so it's not too bad to quit the game.
	Player leaver = null;
	for(Player p : session.getPlayers()) {
		if(p.getID() == message.origin) {
			leaver = p;
		}
	}
	session.removePlayer(leaver);
	System.out.println(leaver.getName()+" LEFT THE GAME");
	 * */
	if(FEServer.getServer() != null) {
		//boot the server back to lobby
		FEServer.resetToLobbyAndKickPlayers();
	}else{
		//exit the client
		if(message!=null && !message.equals("")){
			Sys.alert("FE:MP", message);
		}
		System.exit(0);
	}
}
 
开发者ID:eliatlarge,项目名称:FEMultiPlayer-V2,代码行数:32,代码来源:FEMultiplayer.java

示例2: main

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Application init
 * @param args Commandline args
 */
public static void main(String[] args) {
	try {
		init();
		run();
	} catch (Exception e) {
		e.printStackTrace(System.err);
		Sys.alert(GAME_TITLE, "An error occured and the game will exit.");
	} finally {
		cleanup();
	}

	System.exit(0);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:Game.java

示例3: testAlert

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Tests the alert
 */
private void testAlert() {
  System.out.println("==== Test Alert ====");
  
  System.out.println("Opening native alert window");
  Sys.alert("SysTest", "Hello World!");
  
  System.out.println("---- Test Alert ----\n"); 
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:12,代码来源:SysTest.java

示例4: loadShader

import org.lwjgl.Sys; //导入方法依赖的package包/类
private static int loadShader(String name, int type) {
	StringBuilder shaderSource = new StringBuilder();
	try {
		BufferedReader reader = new BufferedReader(new InputStreamReader(ShaderProgram.class.getClassLoader().getResourceAsStream("assets/shaders/" + name)));
		String line;
		while ((line = reader.readLine()) != null) {
			shaderSource.append(line).append("\n");
		}
		reader.close();
	} catch (IOException e) {
		Log.severe("Could not read shader file '" + name + "'");
		Log.stackTrace(Level.SEVERE, e);
		Log.save();
		
		System.exit(0);
	}
	int shaderID = GL20.glCreateShader(type);
	GL20.glShaderSource(shaderID, shaderSource);
	GL20.glCompileShader(shaderID);
	if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
		String reason = GL20.glGetShaderInfoLog(shaderID, 500);
		Log.severe(LangUtil.get("errors.shader.compile") + " '" + name + "'\nReason: " + reason);
		Sys.alert(GameInfo.title, LangUtil.get("errors.shader.compile") + " '" + name + "'\nReason: " + reason +"\n"+ LangUtil.get("errors.log"));
		Log.save();
		System.exit(-1);
	}
	return shaderID;
}
 
开发者ID:roryclaasen,项目名称:sandbox,代码行数:29,代码来源:ShaderProgram.java

示例5: fail

import org.lwjgl.Sys; //导入方法依赖的package包/类
public final static void fail(Throwable t) {
	try {
		t.printStackTrace();
		if (Display.isCreated())
			Display.destroy();
		while (t.getCause() != null)
			t = t.getCause();
		ResourceBundle bundle = ResourceBundle.getBundle(Main.class.getName());
		String error = Utils.getBundleString(bundle, "error");
		String error_msg = Utils.getBundleString(bundle, "error_message", new Object[]{t.toString(), Globals.SUPPORT_ADDRESS});
		Sys.alert(error, error_msg);
	} finally {
		shutdown();
	}
}
 
开发者ID:sunenielsen,项目名称:tribaltrouble,代码行数:16,代码来源:Main.java

示例6: getOgg

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Get the Sound based on a specified OGG file
 * 
 * @param ref The reference to the OGG file in the classpath
 * @param in The stream to the OGG to load
 * @return The Sound read from the OGG file
 * @throws IOException Indicates a failure to load the OGG
 */
public Audio getOgg(String ref, InputStream in) throws IOException {
	if (!soundWorks) {
		return new NullAudio();
	}
	if (!inited) {
		throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
	}
	if (deferred) {
		return new DeferredSound(ref, in, DeferredSound.OGG);
	}
	
	int buffer = -1;
	
	if (loaded.get(ref) != null) {
		buffer = ((Integer) loaded.get(ref)).intValue();
	} else {
		try {
			IntBuffer buf = BufferUtils.createIntBuffer(1);
			
			OggDecoder decoder = new OggDecoder();
			OggData ogg = decoder.getData(in);
			
			AL10.alGenBuffers(buf);
			AL10.alBufferData(buf.get(0), ogg.channels > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16, ogg.data, ogg.rate);
			
			loaded.put(ref,new Integer(buf.get(0)));
			                     
			buffer = buf.get(0);
		} catch (Exception e) {
			Log.error(e);
			Sys.alert("Error","Failed to load: "+ref+" - "+e.getMessage());
			throw new IOException("Unable to load: "+ref);
		}
	}
	
	if (buffer == -1) {
		throw new IOException("Unable to load: "+ref);
	}
	
	return new AudioImpl(this, buffer);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:50,代码来源:SoundStore.java

示例7: alert

import org.lwjgl.Sys; //导入方法依赖的package包/类
public static void alert(String message) {
	Sys.alert(GameInfo.title, message);
}
 
开发者ID:roryclaasen,项目名称:sandbox,代码行数:4,代码来源:Messages.java

示例8: main

import org.lwjgl.Sys; //导入方法依赖的package包/类
public static void main( String[] args )
{
	int targetWidth = 640;
	int targetHeight = 480;
	 
	
	
	try {
		DisplayMode chosenMode = new DisplayMode(targetWidth,targetHeight);
		
	    Display.setDisplayMode(chosenMode);
	    Display.setTitle("Example Maven Natives");
	    Display.setFullscreen(false);
	    Display.create();
	} catch (LWJGLException e) {
	    Sys.alert("Error","Unable to create display.");
	    System.exit(0);
	}
	 
	GL11.glClearColor(0,0,0,0);
	
	boolean gameRunning = true;
	float pos = 0;
	 
	int FRAMERATE = 60;

	while (gameRunning) {
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);

	 
	     GL11.glRotatef(0.6f, 0, 0, 1);
	     GL11.glBegin(GL11.GL_TRIANGLES);
	          GL11.glVertex3f(-0.5f,-0.5f,0);
	          GL11.glVertex3f(0.5f,-0.5f,0);
	          GL11.glVertex3f(0,0.5f,0);
	       
	     GL11.glEnd();
	 
	     Display.update();
	     Display.sync(FRAMERATE);

	     if (Display.isCloseRequested()) {
	           gameRunning = false;
	           Display.destroy();
	           System.exit(0);
	     }
	}
}
 
开发者ID:virtuoushub,项目名称:mavennatives,代码行数:49,代码来源:App.java


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