Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Newbie question on drawing entities  (Read 1711 times)

0 Members and 1 Guest are viewing this topic.

mongrol

  • Newbie
  • *
  • Posts: 29
    • View Profile
Newbie question on drawing entities
« on: June 15, 2009, 05:15:28 am »
Hi folks,
After learning Objc-C and Cocoa I've decided to turn to game programming and C++. I'm starting off with a simple roguelike and read through the graphics tutorials and a little stuck already in how things are drawn.

I have my map stored in an array[5][5] of ints. A 1 is a wall and a 0 for a floor. I've created two text objects for the different elements. "#" and "." for my wall and floor.

I intend to iterate the array and draw the corresponding tile. Forgive my psuedo code but I'm not near my machine at present.

Code: [Select]
App.Clear()
iterate (map)
   Update x and y for current tile position.
   if (tile == 1)
      Text1.SetPosition(x,y)
      App.Draw(Text1)
   if (tile == 0)
      Text0.SetPosition(x,y)
      App.Draw(Text0)
end iteration
App.Display()

Does that roughly make sense? My concern is around the usage of Clear, Draw and Display in order to display what's essentially the same Text object multiple times on the screen.

mongrol

  • Newbie
  • *
  • Posts: 29
    • View Profile
Newbie question on drawing entities
« Reply #1 on: June 15, 2009, 03:14:49 pm »
I was right. :)

More daft questions I'll probably answer myself coming soon.

 

anything