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


Java JmeCanvasContext类代码示例

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


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

示例1: createCanvas

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public Canvas createCanvas() {
    String appClass = TestEditor.class.getName();
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setFrameRate(30);

    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        app = clazz.newInstance();
        app.setPauseOnLostFocus(false);
        app.setSettings(settings);
        app.createCanvas();
        app.startCanvas();

        JmeCanvasContext context = (JmeCanvasContext) app.getContext();
        Canvas canvas = context.getCanvas();
        canvas.setSize(settings.getWidth(), settings.getHeight());

        return canvas;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        ex.printStackTrace();
    }
    return null;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:26,代码来源:TestSwing2.java

示例2: createCanvas

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public static Canvas createCanvas() {
    String appClass = TestEditor.class.getName();
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setFrameRate(60);

    try {
        Class<? extends LegacyApplication> clazz = (Class<? extends LegacyApplication>) Class.forName(appClass);
        LegacyApplication app = clazz.newInstance();
        app.setPauseOnLostFocus(false);
        app.setSettings(settings);
        app.createCanvas();
        app.startCanvas();

        JmeCanvasContext context = (JmeCanvasContext) app.getContext();
        Canvas canvas = context.getCanvas();
        canvas.setSize(settings.getWidth(), settings.getHeight());

        return canvas;
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        ex.printStackTrace();
    }
    
    return null;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:27,代码来源:SwingUtils.java

示例3: getPanel

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
private Container getPanel() {
   	Dimension d3Dim = new Dimension (800, 600);
	
	AppSettings settings = new AppSettings(true);
	
	settings.setWidth(d3Dim.width);
	settings.setHeight(d3Dim.height);
	settings.setSamples(4);
	settings.setVSync(true);
	settings.setFrameRate(60);
	
	setSettings(settings);
	createCanvas();
	JmeCanvasContext ctx = (JmeCanvasContext) getContext();
	ctx.setSystemListener(this);
	
	Canvas canvas = ctx.getCanvas();
	canvas.setPreferredSize(d3Dim);
	
	JPanel panel = new JPanel(new BorderLayout());
	panel.add( canvas, BorderLayout.CENTER );
	
	return panel;
}
 
开发者ID:twak,项目名称:siteplan,代码行数:25,代码来源:Preview.java

示例4: AttitudePanel

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public AttitudePanel()
{
	super();
	
	setShowSettings(false);
	setDisplayFps(false);
       setDisplayStatView(false);
       
       setPauseOnLostFocus(false);
       
       AppSettings settings = new AppSettings(true);
	settings.setUseInput(false);
	setSettings(settings);
	
	createCanvas();
	ctx = (JmeCanvasContext) getContext();
	ctx.setSystemListener(this);
	
	ctx.getCanvas().setBackground(Color.BLACK);
	ctx.getCanvas().setFocusable(false);
	ctx.getCanvas().setSize(new Dimension(320, 240));
	
	ctx.getCanvas().setFocusable(false);
}
 
开发者ID:Jupre,项目名称:MarmaraDrone,代码行数:25,代码来源:AttitudePanel.java

示例5: createCanvas

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
private void createCanvas() {
	AppSettings settings = new AppSettings(true);
	settings.setWidth(640);
	settings.setHeight(480);
	settings.setFrameRate(60);

	config = Util.getConfig();

	viewer = new Viewer();
	viewer.setPauseOnLostFocus(false);
	viewer.setSettings(settings);
	viewer.createCanvas();
	viewer.startCanvas();

	context = (JmeCanvasContext) viewer.getContext();
	canvas = context.getCanvas();
	canvas.setSize(settings.getWidth(), settings.getHeight());
}
 
开发者ID:morris,项目名称:vstools-java,代码行数:19,代码来源:GUI.java

示例6: main

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException{
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

    final TestSafeCanvas app = new TestSafeCanvas();
    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas(true);

    JmeCanvasContext context = (JmeCanvasContext) app.getContext();
    Canvas canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());

    

    Thread.sleep(3000);

    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            app.stop();
        }
    });
    frame.getContentPane().add(canvas);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    Thread.sleep(3000);

    frame.getContentPane().remove(canvas);

    Thread.sleep(3000);

    frame.getContentPane().add(canvas);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:TestSafeCanvas.java

示例7: getMainPanel

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public Component getMainPanel() {
    if (useCanvas) {
        return ((JmeCanvasContext) getContext()).getCanvas();
    } else {
        if (panel == null) {
            panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated, true);
            ((AwtPanelsContext) getContext()).setInputSource(panel);
            attachPanel();
        }
        return panel;
    }
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:13,代码来源:SceneApplication.java

示例8: create

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
/**
 * 使用指定的settings及指定的jfxRoot根节点来创建游戏。
 * @param appClass
 * @param settings
 * @param jfxRoot
 */
public static void create(String appClass, AppSettings settings, Pane jfxRoot) {
    Jfx.jfxRoot = jfxRoot;
    
    // 创建主界面,这个界面会包含Canvas,用于渲染游戏。
    mainFrame = createMainFrame(appClass, settings);
    mainFrame.setTitle("LuoYing RPG");
    
    jmeApp = createAppCanvas(appClass, settings);
    
    jmeCanvas = ((JmeCanvasContext) jmeApp.getContext()).getCanvas();
    jmeCanvas.setSize(settings.getWidth(), settings.getHeight());
    
    // 创建Jfx界面,这个界面会包含JFX组件,作为UI界面,该界面始终覆盖在mainFrame上面
    jWindow = createJWindow(mainFrame, jfxRoot);
    jWindow.setName("JFXWindow");
    jWindow.setSize(mainFrame.getSize());
    
    mainFrame.add(jmeCanvas);
    mainFrame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            super.windowClosed(e);
            // 这里应该不需要放在jme app线程
            jmeApp.stop();
        }
    });
    mainFrame.setVisible(true);
    
    // 绑定Jfx窗口,使Jfx窗口始终与mainFrame的位置和大小一致。
    bindingController = new CanvasJfxBindingController();
    bindingController.bind(jWindow, mainFrame);
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:39,代码来源:Jfx.java

示例9: ModuleControl

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
ModuleControl(EditorMain app) {
        this.app = app;
        rootNode = app.getRootNode();
        canvas = ((JmeCanvasContext) app.getContext()).getCanvas();
        defaultSetting = new DefaultSetting(app);

        canvasResizer();

//        tabController.setPreferredSize(canvas.getSize());
        tabController.registerTabChangeListener(this);
    }
 
开发者ID:MultiverseKing,项目名称:HexGrid_JME,代码行数:12,代码来源:ModuleControl.java

示例10: EditorMain

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public EditorMain(String windowName) {
    AppSettings initSettings = new AppSettings(true);
    Dimension dim = new Dimension(1024, 768);
    initSettings.setWidth(dim.width);
    initSettings.setHeight(dim.height);

    rootFrame = new JFrame(windowName);
    rootFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    rootFrame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            stop();
        }
    });
    setSettings(initSettings);

    createCanvas(); // create canvas!
    JmeCanvasContext ctx = (JmeCanvasContext) getContext();
    ctx.getCanvas().setSize(dim);

    //-------------
    rootFrame.setJMenuBar(new JMenuBar());

    moduleControl = new ModuleControl(this);
    rootFrame.getContentPane().add(moduleControl.getContent());

    //-------------

    rootFrame.setMinimumSize(dim);
    rootFrame.pack();
    rootFrame.setLocationRelativeTo(null);
    rootFrame.setVisible(true);

    startCanvas();
    ctx.setSystemListener(this);
}
 
开发者ID:MultiverseKing,项目名称:HexGrid_JME,代码行数:37,代码来源:EditorMain.java

示例11: componentOpened

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
@Override
public void componentOpened() {
    // TODO add custom code on component opening
    sceneApplication = new ViewerSceneApplication();
    sceneApplication.createCanvas();
    JmeCanvasContext ctx = (JmeCanvasContext) sceneApplication.getContext();
    ctx.setSystemListener(sceneApplication);
    Dimension dim = new Dimension(640, 480);
    ctx.getCanvas().setPreferredSize(dim);
    
    sceneApplication.startCanvas();
    
    this.add(ctx.getCanvas());
}
 
开发者ID:atomixnmc,项目名称:AtomBaseSDK,代码行数:15,代码来源:ViewerTopComponent.java

示例12: getMainPanel

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public Component getMainPanel() {
    if (useCanvas) {
        return ((JmeCanvasContext)getContext()).getCanvas();
    } else {
        if (panel == null) {
            panel = ((AwtPanelsContext) getContext()).createPanel(PaintMode.Accelerated);
            panel.attachTo(true, viewPort, overlayView, guiViewPort);
            ((AwtPanelsContext) getContext()).setInputSource(panel);
        }
        return panel;
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:13,代码来源:SceneApplication.java

示例13: TweedFrame

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public TweedFrame() {

		instance = this;

		frame = new JFrame();

		WindowManager.register( frame );

		Dimension d3Dim = new Dimension( 1024, 640 );

		AppSettings settings = new AppSettings( true );

		settings.setWidth( d3Dim.width );
		settings.setHeight( d3Dim.height );
		settings.setSamples( 4 );
		settings.setVSync( true );
		settings.setFrameRate( 60 );

		tweed = new Tweed( this );
		tweed.setSettings( settings );
		tweed.createCanvas();
		JmeCanvasContext ctx = (JmeCanvasContext) tweed.getContext();
		ctx.setSystemListener( tweed );

		canvas = ctx.getCanvas();
		canvas.setPreferredSize( d3Dim );

		frame.setLayout( new BorderLayout() );
		frame.add( buildUI(), BorderLayout.EAST );
		frame.add( canvas, BorderLayout.CENTER );
		frame.setExtendedState( frame.getExtendedState() | JFrame.MAXIMIZED_BOTH );

		frame.addWindowListener( new WindowAdapter() {
			public void windowClosing( WindowEvent e ) {
				TweedSettings.save(true);
				Tweed.deleteScratch();
			};
		} );

		scheduler.scheduleAtFixedRate( new Runnable() {
			@Override
			public void run() {
				TweedSettings.save(true);
			}
		}, 30, 30, TimeUnit.SECONDS );

		scheduler.scheduleAtFixedRate( new Runnable() {
			@Override
			public void run() {
				Vector3d pt = tweed.cursorPosition;
				if ( coordLabel != null && TweedSettings.settings.trans != null) {
					worldLabel.setText( pt == null ? "..." : String.format( "%.4f, %.4f ", 
							pt.x, 
							pt.z) );
					coordLabel.setText( pt == null ? "..." : String.format( "%.4f, %.4f ", 
							pt.x + TweedSettings.settings.trans[0], 
							pt.z + TweedSettings.settings.trans[1]) );
					crsLabel.setText(TweedSettings.settings.gmlCoordSystem);
				}

				JFrame.setDefaultLookAndFeelDecorated( true );

			}
		}, 100, 100, TimeUnit.MILLISECONDS );

		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		frame.pack();
		frame.setVisible( !HEADLESS );

		tweed.startCanvas();
	}
 
开发者ID:twak,项目名称:chordatlas,代码行数:72,代码来源:TweedFrame.java

示例14: SandboxFrame

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
/**
 * Creates new form SandboxFrame
 */
public SandboxFrame() {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    kfm.addKeyEventDispatcher(new DAEKeyboardManager());
    initComponents();
    cboTranslateSpace.setModel(new DefaultComboBoxModel(TranslateGizmoSpace.values()));
    cboRotateSpace.setModel(new DefaultComboBoxModel(RotateGizmoSpace.values()));

    cboTranslateSpace.setSelectedItem(TranslateGizmoSpace.LOCAL);
    cboRotateSpace.setSelectedItem(RotateGizmoSpace.LOCAL);

    cboTranslateSpace.setRenderer(new TransformSpaceRenderer());
    cboRotateSpace.setRenderer(new TransformSpaceRenderer());

    SwingUtilities.updateComponentTreeUI(this);
    GlobalObjects.getInstance().registerListener(this);

    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);
    settings.setVSync(true);

    //settings.set
    viewport = new SandboxViewport();
    viewport.setSettings(settings);

    viewport.createCanvas(); // create canvas!
    JmeCanvasContext ctx = (JmeCanvasContext) viewport.getContext();
    ctx.setSystemListener(viewport);
    Dimension dim = new Dimension(640, 480);
    ctx.getCanvas().setPreferredSize(dim);
    ctx.getCanvas().setMinimumSize(new Dimension(320, 240));
    DropTarget dropTarget = new DropTarget(ctx.getCanvas(), this);
    viewport.startCanvas();

    pnlViewPort.setLeftComponent(ctx.getCanvas());
    propertiesPanel1.validate();

    createProjectDialog = new CreateProjectDialog(this, true);
    createObjectDialog = new CreateKlatchDialog(this, true);
    createObjectDialog.setExtension("rig");
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:46,代码来源:SandboxFrame.java

示例15: main

import com.jme3.system.JmeCanvasContext; //导入依赖的package包/类
public static void main(String[] args){
		final HexScapeCore core = HexScapeCore.getInstance();
		final SimpleApplication app = core.getHexScapeJme3Application();
		
		AppSettings settings = new AppSettings(true);
		//settings.setCustomRenderer(SwingContext.class);
		settings.setFrameRate(60);
		settings.setWidth(102);
		settings.setWidth(77);
		
		
		app.setShowSettings(false);
		app.setSettings(settings);
		
		
		
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				app.createCanvas();
				
				JmeCanvasContext ctx = (JmeCanvasContext) app.getContext();
				ctx.setSystemListener(app);
				Dimension dim = new Dimension(640, 480);
				ctx.getCanvas().setPreferredSize(dim);
				
				new HexScapeFrame(new View3d(ctx.getCanvas()));
				
				app.startCanvas();
				
//				app.getHexScapeJme3Application().createCanvas();
//				
//				final SwingContext ctx = (SwingContext)app.getHexScapeJme3Application().getContext();
//				
//				ctx.setSystemListener(app.getHexScapeJme3Application());
//				
//				final Canvas panel3d = ctx.getCanvas();
//				
//				Dimension dim = new Dimension(102, 77);
//				panel3d.setMinimumSize(dim);
//				panel3d.setEnabled(false);
//				
//				app.getHexScapeJme3Application().startCanvas();
//				
//		        new HexScapeFrame(new View3d(panel3d));
		        
		        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
			}
		});

		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
	        public void run() {
	        	DisconnectFromServerMessage message = new DisconnectFromServerMessage();
	        	CoreMessageBus.post(message);
	        }
	    }, "Disconnect from server"));
	}
 
开发者ID:lyrgard,项目名称:HexScape,代码行数:57,代码来源:HexScapeDesktopGui.java


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