DF/Tutorial/5

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

5. Drawing A Map

Goal

Draw a map, any map, not necessarily a map based on a model.

Introduction

Before we introduce the map model, we first need to see how we can render it. This will give us hints on what data our model needs to have, as well as give us an idea on how to formulate the abstraction layers between the view and the model.

Tileset

Let's make a tileset image that will be used to draw tiles.

  • Ground squares
  • Rock squares
  • Water squares

Textures

Let's start by loading a texture and putting it on the square we have.

Multiple Squares

Let's draw multiple squares with the same texture.

Tiles

Let's draw multiple squares, each with a different tile.

Random Map

Let's draw hundreds of squares, each with a random tile.

Performance

Let's make the drawing routing very, very fast.

Next: 6. Drawing THE Map