[gtkmm] A better way to paint? (using draw_rectangle)
- From: "Drinkin Park" <drink_n_park hotmail com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] A better way to paint? (using draw_rectangle)
- Date: Fri, 24 Oct 2003 00:51:50 +0000
Hi all,
I am currently working on a tile-based map editor for a game, and I am using
gtkmm to produce it.
This is the method that I am currently using to display the map in a
Gtk::DrawingArea:
----------------------------------
...
//xMin, yMin = the top-left co-ordinates of the map to display in the
DrawingArea.
//xMax, yMax = the bottom-right co-ordinates of map to display.
//map = a 2D array that holds the actual map.
//zoom = the zoom factor of the window.
// zoom = 1: one pixel in image = one pixel on screen
// zoom = 2: one pixel in image = two pixels on screen
for (int i = xMin; i <= xMax; i++)
for (int j = yMin; j <= yMax; j++)
if (i >= 0 && i < MAP_XSIZE && j >= 0 && j < MAP_YSIZE)
{
if (map[i][j] != 0)
get_window()->draw_rectangle(gc, true, mapToScreenX(i),
mapToScreenY(j), zoom, zoom);
}
...
----------------------------------
The problem I am having is, that when the zoom factor is low (and hence the
draw_rectangle method is called many times) screen updates occur very
slowly. Is there a faster method for drawing to the screen using gtkmm?
Thanks in advance.
_________________________________________________________________
Hot chart ringtones and polyphonics. Go to
http://ninemsn.com.au/mobilemania/default.asp
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]