• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PlayN类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: openFileChooser

import playn.core.PlayN; //导入依赖的package包/类
protected void openFileChooser ()
{
    new Thread(new Runnable() {
        public void run () {
            FileDialog dialog = new FileDialog((Frame)null);
            dialog.setDirectory(PlayN.storage().getItem(PREF_KEY));
            dialog.setFilenameFilter(new FilenameFilter() {
                @Override public boolean accept (File dir, String name) {
                    return name.endsWith(".json");
                }
            });

            dialog.setVisible(true);
            String filename = dialog.getFile();
            if (filename != null) {
                final File file = new File(dialog.getDirectory(), filename);
                PlayN.platform().invokeLater(new Runnable() {
                    @Override public void run () {
                        loadFlumpLibrary(file);
                    }
                });
            }
        }
    }).start();
}
 
开发者ID:deadmoose,项目名称:flumptools,代码行数:26,代码来源:FlumpViewScreen.java


示例2: requireResource

import playn.core.PlayN; //导入依赖的package包/类
@Override protected URL requireResource (String path)
    throws FileNotFoundException
{
    URL url = null;
    try {
        url = new File(path).toURI().toURL();
    } catch (MalformedURLException mue) {
        PlayN.log().error("Error loading file: " + path, mue);
    }

    if (url == null) {
        throw new FileNotFoundException(path);
    }

    return url;
}
 
开发者ID:deadmoose,项目名称:flumptools,代码行数:17,代码来源:FileAssets.java


示例3: onStart

import playn.core.PlayN; //导入依赖的package包/类
@Override protected void onStart() {
  super.onStart();
  try {
    FlurryAgent.onStartSession(this, "FLURRYKEY");
  } catch (Throwable t) {
    PlayN.log().warn("Error noting session start for Flurry", t);
  }
}
 
开发者ID:playn,项目名称:playn-samples,代码行数:9,代码来源:FlurryExampleActivity.java


示例4: onStop

import playn.core.PlayN; //导入依赖的package包/类
@Override protected void onStop() {
  super.onStop();
  try {
    FlurryAgent.onEndSession(this);
  } catch (Throwable t) {
    PlayN.log().warn("Error noting session end for Flurry", t);
  }
}
 
开发者ID:playn,项目名称:playn-samples,代码行数:9,代码来源:FlurryExampleActivity.java


示例5: start

import playn.core.PlayN; //导入依赖的package包/类
@Override
public void start() {
  HtmlPlatform.Config config = new HtmlPlatform.Config();
  // use config to customize the HTML platform, if needed
  HtmlPlatform platform = HtmlPlatform.register(config);
  platform.assets().setPathPrefix("playn-flurry/");
  PlayN.run(new FlurryExample());
}
 
开发者ID:playn,项目名称:playn-samples,代码行数:9,代码来源:FlurryExampleHtml.java


示例6: clearUseless

import playn.core.PlayN; //导入依赖的package包/类
public void clearUseless() {
    Iterator<Map.Entry<CachedTextKey, CachedTextImage>> it = cache.entrySet().iterator();
    final double currentTime = PlayN.currentTime();
    while (it.hasNext()) {
        Map.Entry<CachedTextKey, CachedTextImage> entry = it.next();
        final CachedTextImage cached = entry.getValue();
        if (currentTime > cached.timeToDie) {
            it.remove();
        }
    }
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:12,代码来源:PlaynTextCache.java


示例7: getTextCanvasImage

import playn.core.PlayN; //导入依赖的package包/类
public CanvasImage getTextCanvasImage(String text, int color) {
    CachedTextKey key = new CachedTextKey(text, color);
    CachedTextImage cached = cache.get(key);
    if (null == cached) {
        cached = new CachedTextImage();
        cached.image = createTextCanvasImage(text, color);
        cache.put(key, cached);
    }
    double currentTime = PlayN.currentTime();
    cached.timeToDie = currentTime + LIFETIME;
    return cached.image;
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:13,代码来源:PlaynTextCache.java


示例8: createTextCanvasImage

import playn.core.PlayN; //导入依赖的package包/类
private CanvasImage createTextCanvasImage(String text, int color) {
    final Graphics graphics = PlayN.graphics();
    TextLayout textLayout = graphics.layoutText(text, font.format);
    CanvasImage textImage = graphics.createImage(textLayout.width(), textLayout.height());
    final Canvas canvas = textImage.canvas();
    canvas.setFillColor(Color.argb(0, 123, 123, 123));
    canvas.fillRect(0, 0, canvas.width(), canvas.height());
    canvas.setFillColor(color);
    canvas.fillText(textLayout, 0, 0);
    return textImage;
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:12,代码来源:PlaynTextCache.java


示例9: getPossibleControls

import playn.core.PlayN; //导入依赖的package包/类
@Override
public Control[] getPossibleControls() {
    List<Control> possibleControls = new ArrayList<Control>();
    for (Key key : Key.values()) {
        possibleControls.add(new KeyControl(this, key));
    }
    possibleControls.add(getClickControl());
    if (PlayN.mouse().hasMouse()) {
        possibleControls.add(getRightClickControl());
        possibleControls.add(getMiddleClickControl());
    }
    return possibleControls.toArray(new Control[possibleControls.size()]);
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:14,代码来源:PlaynNuitControls.java


示例10: putControl

import playn.core.PlayN; //导入依赖的package包/类
@Override
public void putControl(String name, Control value) {
    if (null != value) {
        PlayN.storage().setItem(name + ".controller", value.getControllerName());
        PlayN.storage().setItem(name + ".control", value.getName());
    } else {
        PlayN.storage().removeItem(name + ".controller");
        PlayN.storage().removeItem(name + ".control");
    }
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:11,代码来源:PlaynNuitPreferences.java


示例11: getSystemOrStoreProperty

import playn.core.PlayN; //导入依赖的package包/类
private String getSystemOrStoreProperty(String name, String defaultValue) {
    String value = PlayN.storage().getItem(name);
    if (null != value) {
        return value;
    } else {
        return defaultValue;
    }
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:9,代码来源:PlaynNuitPreferences.java


示例12: getAnimations

import playn.core.PlayN; //导入依赖的package包/类
public IAnimationCollection getAnimations(String name) {
    CachedAnimation cachedAnimation = animations.get(name);
    if (null == cachedAnimation) {
        cachedAnimation = new CachedAnimation();
        cachedAnimation.animations = PlaynAnimationLoader.load(PlayN.assets(), name);
        animations.put(name, cachedAnimation);
    }
    cachedAnimation.timeToDie = PlayN.currentTime() + timeToLive;
    return cachedAnimation.animations;
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:11,代码来源:TimeBasedCachedAssets.java


示例13: clearUseless

import playn.core.PlayN; //导入依赖的package包/类
public void clearUseless() {
    Iterator<Map.Entry<String, CachedAnimation>> it = animations.entrySet().iterator();
    double currentTime = PlayN.currentTime();
    while (it.hasNext()) {
        Map.Entry<String, CachedAnimation> entry = it.next();
        if (currentTime > entry.getValue().timeToDie) {
            it.remove();
        }
    }
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:11,代码来源:TimeBasedCachedAssets.java


示例14: start

import playn.core.PlayN; //导入依赖的package包/类
@Override
public void start() {
  HtmlPlatform.Config config = new HtmlPlatform.Config();
  // use config to customize the HTML platform, if needed
  HtmlPlatform platform = HtmlPlatform.register(config);
  platform.assets().setPathPrefix("playnuitutorial/");
  PlayN.run(new TutorialApp());
}
 
开发者ID:donkirkby,项目名称:playn-ui-tutorial,代码行数:9,代码来源:TutorialAppHtml.java


示例15: start

import playn.core.PlayN; //导入依赖的package包/类
@Override
public void start() {
  HtmlPlatform.Config config = new HtmlPlatform.Config();
  // use config to customize the HTML platform, if needed
  HtmlPlatform platform = HtmlPlatform.register(config);
  platform.assets().setPathPrefix("pokeros/");
  PlayN.run(new Pokeros(0.5f));
}
 
开发者ID:samskivert,项目名称:mashups,代码行数:9,代码来源:PokerosHtml.java


示例16: main

import playn.core.PlayN; //导入依赖的package包/类
public static void main (String[] args)
{
    JavaPlatform.Config config = new JavaPlatform.Config();
    config.width = 1280;
    config.height = 1024;
    JavaPlatform.register(config);

    JavaPlatform platform = new JavaPlatform(config);
    platform.setPropagateEvents(true);

    platform.setTitle("Flumpview");
    PlayN.setPlatform(platform);
    PlayN.run(new FlumpView());
}
 
开发者ID:deadmoose,项目名称:flumptools,代码行数:15,代码来源:FlumpView.java


示例17: run

import playn.core.PlayN; //导入依赖的package包/类
public final void run ()
{
    JavaPlatform.Config config = new JavaPlatform.Config();
    config.headless = true;

    JavaPlatform.register(config);

    JavaPlatform platform = new JavaPlatform(config) {
        @Override
        public void invokeLater (Runnable runnable) {
            // Just do it NOW
            runnable.run();
        }

        @Override
        public JavaAssets assets () {
            return _assets;
        }
        protected JavaAssets _assets = new FileAssets(this);
    };
    PlayN.setPlatform(platform);

    try {
        execute();
    } catch (IllegalArgumentException e) {
        System.err.println(e.getMessage());
        System.exit(-1);
    }
}
 
开发者ID:deadmoose,项目名称:flumptools,代码行数:30,代码来源:PlayNTool.java


示例18: main

import playn.core.PlayN; //导入依赖的package包/类
public static void main (String[] args) {
    JavaPlatform.Config config = new JavaPlatform.Config();
    config.width = 1024;
    config.height = 768;
    JavaPlatform pf = JavaPlatform.register(config);
    pf.setTitle("PlayN Performance Tests");
    PlayN.run(new PerfTest());
}
 
开发者ID:playn,项目名称:playn-perf,代码行数:9,代码来源:PerfTestJava.java


示例19: wasShown

import playn.core.PlayN; //导入依赖的package包/类
@Override public void wasShown () {
    super.wasShown();

    final CanvasImage image = PlayN.graphics().createImage(2, 2);
    image.canvas().setFillColor(0xFFFFFFFF);
    image.canvas().fillRect(0, 0, 2, 2);

    _count.connectNotify(new Listener<Integer>() {
        @Override
        public void onChange (Integer value, Integer oldValue) {
            if (_emitter != null) {
                _emitter.destroy();
            }

            _emitter = _particles.createEmitter(value, image, layer);
            _emitter.generator = Generator.constant(value);
            _emitter.initters.add(Lifespan.random(_rando, 1, 1.5f));
            _emitter.initters.add(Color.constant(Colors.RED));
            _emitter.initters.add(Transform.layer(_emitter.layer));
            _emitter.initters.add(Velocity.randomNormal(_rando, 50, 200));
            _emitter.effectors.add(Alpha.byAge(Interpolator.EASE_IN));
            _emitter.effectors.add(new Gravity(30));
            _emitter.effectors.add(new Move());
            _emitter.layer.setTranslation(
                PlayN.graphics().width()/2, PlayN.graphics().height()/2);
        }
    });
}
 
开发者ID:playn,项目名称:playn-perf,代码行数:29,代码来源:ParticleBurst.java


示例20: getResolution

import playn.core.PlayN; //导入依赖的package包/类
@Override
public VideoResolution getResolution() {
    return new VideoResolution(PlayN.graphics().width(), PlayN.graphics().height());
}
 
开发者ID:devnewton,项目名称:jnuit,代码行数:5,代码来源:PlaynNuitDisplay.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SpriteCache类代码示例发布时间:2022-05-23
下一篇:
Java MonitoringParameters类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap