[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog src/Editor/SDLView.cpp sr...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog src/Editor/SDLView.cpp sr... |
Date: |
Fri, 21 Nov 2003 17:33:53 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/11/21 17:33:15
Modified files:
. : ChangeLog
src/Editor : SDLView.cpp TileSet.cpp
Log message:
adding more tiles to the Tileset works now in the editor
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.34 netpanzer/ChangeLog:1.35
--- netpanzer/ChangeLog:1.34 Fri Nov 21 09:47:10 2003
+++ netpanzer/ChangeLog Fri Nov 21 17:33:11 2003
@@ -3,6 +3,7 @@
select the location where built units move.
-added a possibility to use custom config files. This makes it possible to
spawn several different bots or servers on the same user account.
+-adding new tiles to Tileset works now in editor
20-Nov-2003 by Matthias Braun
-removed lots of remaining nonused code handling with UDP networking
Index: netpanzer/src/Editor/SDLView.cpp
diff -u netpanzer/src/Editor/SDLView.cpp:1.2
netpanzer/src/Editor/SDLView.cpp:1.3
--- netpanzer/src/Editor/SDLView.cpp:1.2 Thu Nov 20 19:19:23 2003
+++ netpanzer/src/Editor/SDLView.cpp Fri Nov 21 17:33:15 2003
@@ -60,7 +60,7 @@
height += 4 - (height % 4);
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 24,
- 0x000000FF, 0x0000FF00, 0x00FF0000, 0);
+ 0xFF0000, 0x00FF00, 0x0000FF, 0);
if(!surface || surface->pitch != surface->w * 3)
throw Exception("Couldn't create SDLsurface for wxwindows (size
%dx%d)",
width, height);
Index: netpanzer/src/Editor/TileSet.cpp
diff -u netpanzer/src/Editor/TileSet.cpp:1.3
netpanzer/src/Editor/TileSet.cpp:1.4
--- netpanzer/src/Editor/TileSet.cpp:1.3 Thu Nov 20 19:19:23 2003
+++ netpanzer/src/Editor/TileSet.cpp Fri Nov 21 17:33:15 2003
@@ -135,7 +135,8 @@
{
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(
tiledata + (tilesize*num), header->tilewidth, header->tileheight,
- header->tilebitsperpixel, header->tilewidth,
+ header->tilebitsperpixel, header->tilewidth * (header->tilebitsperpixel
+ / 8),
0x000000ff, 0x0000ff00, 0x00ff0000, 0);
if(!surface)
throw Exception(
@@ -154,7 +155,8 @@
SDL_Rect* rect = srcrect;
if(rect == 0) {
rect = new SDL_Rect;
- rect->x = rect->y = 0;
+ rect->x = 0;
+ rect->y = 0;
rect->w = header->tilewidth;
rect->h = header->tileheight;
} else {
@@ -173,26 +175,20 @@
resizeBuffer(tilebuffersize * 2 + tilesize);
int bpp = surface->format->BytesPerPixel;
+ std::cout << "BPP:" << bpp << std::endl;
+ std::cout << "Pitch:" << surface->pitch << std::endl;
char* sptr = ((char*) surface->pixels) +
rect->y * surface->pitch + rect->x * bpp;
char* dptr = tiledata + (tilesize * header->tilecount);
+ //size_t align = surface->pitch - rect->w * bpp;
+ size_t linesize = rect->w * bpp;
+ //std::cout << "Align: " << align << std::endl;
for(int lines=rect->h-1; lines>=0; lines--) {
- for(int x=0;x<rect->w; x++) {
- // XXX slow... this switch should be put outside the loop...
- switch(bpp) {
- case 3:
- memcpy(dptr, sptr, 3);
- break;
- case 4:
- *((uint32_t*) dptr) = *((uint32_t*) sptr);
- break;
- default:
- throw Exception("unsupported bpp");
- }
- sptr += bpp;
- }
+ memcpy(dptr, sptr, linesize);
+
sptr += surface->pitch;
+ dptr += linesize;
}
header->tilecount++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./ChangeLog src/Editor/SDLView.cpp sr...,
Matthias Braun <=