1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.maps; 18 19 import com.badlogic.gdx.graphics.OrthographicCamera; 20 import com.badlogic.gdx.math.Matrix4; 21 22 /** Models a common way of rendering {@link Map} objects */ 23 public interface MapRenderer { 24 /** Sets the projection matrix and viewbounds from the given camera. If the camera changes, you have to call this method again. 25 * The viewbounds are taken from the camera's position and viewport size as well as the scale. This method will only work if 26 * the camera's direction vector is (0,0,-1) and its up vector is (0, 1, 0), which are the defaults. 27 * @param camera the {@link OrthographicCamera} */ setView(OrthographicCamera camera)28 public void setView (OrthographicCamera camera); 29 30 /** Sets the projection matrix for rendering, as well as the bounds of the map which should be rendered. Make sure that the 31 * frustum spanned by the projection matrix coincides with the viewbounds. 32 * @param projectionMatrix 33 * @param viewboundsX 34 * @param viewboundsY 35 * @param viewboundsWidth 36 * @param viewboundsHeight */ setView(Matrix4 projectionMatrix, float viewboundsX, float viewboundsY, float viewboundsWidth, float viewboundsHeight)37 public void setView (Matrix4 projectionMatrix, float viewboundsX, float viewboundsY, float viewboundsWidth, 38 float viewboundsHeight); 39 40 /** Renders all the layers of a map. */ render()41 public void render (); 42 43 /** Renders the given layers of a map. 44 * 45 * @param layers the layers to render. */ render(int[] layers)46 public void render (int[] layers); 47 } 48