简体   繁体   English

光滑的tiledmap渲染说明

[英]Slick tiledmap render explanation

Im trying to render a map for a game I am making using tiled map from the slick class but im having a lot of trouble understanding the difference between the parameters x and y. 我正在尝试使用光滑类中的平铺地图为游戏绘制地图,但是我在理解参数x和y之间的差异时遇到了很多麻烦。 Below is a googled explanation but im not understanding it 以下是谷歌的解释,但我不理解

public void render(int x,
               int y,
               int sx,
               int sy,
               int width,
               int height)
Render a section of the tile map
Parameters:
x - The x location to render at
y - The y location to render at
sx - The x tile location to start rendering
sy - The y tile location to start rendering
width - The width of the section to render (in tiles)
height - The height of the secton to render (in tiles)

My game consists of a car and a camera locked onto it which will follow the car around on the map. 我的游戏包括汽车和锁定在其上的摄像头,它将跟随汽车在地图上的周围。 The map starts to render as the car move. 随着汽车移动,地图开始渲染。 Could someone give me an explanation on how x and y and sx and sy applies to this. 有人可以给我解释一下x和y以及sx和sy如何应用于此。

The render function takes a rectangular area of tiles and draws them onto a rectangular area of pixels on the screen. render功能获取一个矩形的拼贴区域,并将其绘制到屏幕上像素的矩形区域。

  • x and y specify the top left corner of the pixel rectangle xy指定像素矩形的左上角

  • sx and sy specify the top left corner of the tile rectangle sxsy指定图块矩形的左上角

  • width and height specify the area of the tile rectangle widthheight指定图块矩形的面积

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

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