简体   繁体   中英

Slick2d increase screenresolution without increasing field of view

So I've implemented a scrolling camera to my slick2d game which works fine for me. But if I change the resolution of my game, eg from 800x600 to 1280x960 the field of view of the player increases extremly.

This is my camera class: 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. As long as you are using the Slick graphics and images to render the map, it should scale everything according to the resolution.

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

If I change all gc.getWidth & gc.Height in my cameraclass to a fixed value eg 800x600 it works.

Thanks for the help. It doesn't look really good tho, but thats another topic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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