简体   繁体   English

Slick2d增加screenresolution而不增加视野

[英]Slick2d increase screenresolution without increasing field of view

So I've implemented a scrolling camera to my slick2d game which works fine for me. 所以我在我的slick2d游戏中实现了一个滚动相机,这对我来说很好。 But if I change the resolution of my game, eg from 800x600 to 1280x960 the field of view of the player increases extremly. 但是如果我改变游戏的分辨率,例如从800x600改为1280x960,则玩家的视野极度增加。

This is my camera class: http://pastebin.java-gaming.org/8a70696904d1d 这是我的相机类: http//pastebin.java-gaming.org/8a70696904d1d

Is there a way to increase screen resolution without increasing the field of view for the player? 有没有办法增加屏幕分辨率而不增加播放器的视野?

Thanks! 谢谢!

Use the ScalableGame Class. 使用ScalableGame类。 As long as you are using the Slick graphics and images to render the map, it should scale everything according to the resolution. 只要您使用Slick图形和图像渲染地图,它就应该根据分辨率缩放所有内容。

A demo on how to use it: 关于如何使用它的演示:

import org.newdawn.slick.ScalableGame;
...
ScalableGame s=new ScalableGame(new GAME CLASS HERE, WIDTH, HEIGHT,false);

    appgc = new AppGameContainer(s);
    appgc.setDisplayMode(705, 720, false);
    appgc.start();

This will scale everything including the player, menus and such. 这将扩展包括播放器,菜单等在内的所有内容。 To understand how to use it read the javadoc here: http://slick.ninjacave.com/javadoc/org/newdawn/slick/ScalableGame.html 要了解如何使用它,请阅读javadoc: http//slick.ninjacave.com/javadoc/org/newdawn/slick/ScalableGame.html

If I change all gc.getWidth & gc.Height in my cameraclass to a fixed value eg 800x600 it works. 如果我将我的cameraclass中的所有gc.getWidth和gc.Height更改为固定值,例如800x600,则可以正常工作。

Thanks for the help. 谢谢您的帮助。 It doesn't look really good tho, but thats another topic. 它看起来不太好,但这是另一个话题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM