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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bernd

Pages: [1]
1
Graphics / skid marks
« on: October 21, 2010, 01:11:00 pm »
I got it working now, the code is not complete yet (and contains errors), but the performance is bad :-(

initialization
Code: [Select]
Color c(0,0,0,0);
imgSkids = new Image(SCREEN_WIDTH, SCREEN_HEIGHT, c);
sprtSkids = Sprite(*imgSkids);
int dim = imgSkids->GetWidth() * imgSkids->GetHeight() * 4;
skidmarks = new Uint8[dim];
for (int i = 0; i < dim; i++)
i % 4 != 0 ? skidmarks[i] = 0 : skidmarks[i] = 255;


called once per frame
Code: [Select]

sprtCarPos = sprtCar.GetPosition();
Uint8 *pixel = &skidmarks[(int)((sprtCarPos.x + (sprtCarPos.y * imgSkids->GetWidth())) * 4)];

if (ABS(lateralforce_f.y) > ABS(MAX_GRIP))
{
*pixel = 0;
*(pixel+1) = 0;
*(pixel+2) = 0;
*(pixel+3) = 255;
imgSkids->LoadFromPixels(imgSkids->GetWidth(), imgSkids->GetHeight(), skidmarks);
w.Draw(sprtSkids);
}

2
Graphics / skid marks
« on: October 21, 2010, 10:33:29 am »
Thanks Laurent, will try that.

3
Graphics / skid marks
« on: October 21, 2010, 10:09:38 am »
I tried shapes. I added a shape to a list every frame (when the car slides), and then drew the hole list. The framerate droppes at a couple hundred shapes.

I don't use a 'camera', so the hole map is always visible, and so are the skidmarks, which probably could easily reach 10000. That's why I wanted to use pixels.

4
Graphics / skid marks
« on: October 21, 2010, 09:00:47 am »
Everytime a car slides (in a curve for example), I want to draw permanent skidmarks for every tire that slips.

5
Graphics / skid marks
« on: October 21, 2010, 08:36:41 am »
Nice project (though a bit overkill for me), but I want to draw the skid marks permanently on the screen.

6
Graphics / skid marks
« on: October 20, 2010, 10:44:22 pm »
Hi,
I'm working on a topdown racing game (GTA like).
I want to draw skid marks of my cars. What would be a fast way to do this?

I tried sf::Shapes in a list, which obviously doesn't work for very long ;-)
Then I tried to have a initially transparent image (same size as the screen) and then use setpixel to draw the skid marks. But even with only one pixel drawn per frame, there is a huge framerate drop.

7
Graphics / Rotating/Snapping
« on: June 06, 2010, 08:38:15 am »
Still got the problem, it's SFML1.6 btw.

8
Graphics / Rotating/Snapping
« on: June 01, 2010, 01:49:40 pm »
Laptop: some Intel-drivers, PC: NVidia
WinXP on both.

Build on PC with MS VS 2008 Professional, Standard on Laptop.

Will try the laptop-binaries on the pc later today.

9
Graphics / Rotating/Snapping
« on: May 31, 2010, 10:37:59 pm »
Hi,
I'm working on a map editor.
I have tiles of 128x128 to place in a grid.
I'm calculating the positions for the tiles from the mouseposition, so while dragging a tile, it snaps to the grid.

I've done it like this: int tile_x = mouse_x/GRID*GRID. (kind of normalizing it to the grid)

Now when I rotate the tiles I get gaps between some of them, is that because of the position? What would be a smarter way to do it?




Edit: Just tested on an other computer, and I dont have any gaps here. Doesn't make sense to me :-(

10
Thanks...had the same problem and it was driving me nuts :-)

11
General / Many warnings when linking
« on: April 08, 2010, 10:34:26 pm »
Hi,
I'm using static linking and compiled SFML, I guess the debug files are somewhere in SFLM-1.6\Temp\vc2008. What do I have to do with them to get rid of the warnings?

Pages: [1]