Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Jun 2012
Offline Last Active Apr 19 2014 11:23 PM

Topics I've Started

UDP - Returning data.

18 April 2014 - 04:43 PM

I'm writing a simple command-line based chat client using C and SDL_net. This page has been useful: http://content.gpwiki.org/SDL:Tutorial:Using_SDL_net#Using_UDP


The code on that page works well for clients connecting to a host and sending messages to the host. What I am now trying to do is have the host send data back to each client.


It seems like it would be relatively simple, but I can't find any notes anywhere for it. Can anyone help me out with the code that needs to be added to the client and the host so the host can send messages back to the clients? Thanks!

SDL 2.0 - Edit Renderer Pixels

31 January 2014 - 12:28 PM

When I was storing the screen as an SDL_Surface, I could multiply colors to it like so:

   Uint32 *pixels = (Uint32 *)screen->pixels;

    unsigned int x, y;

    for(y=0;y<screen->h;y++) {

        for(x=0;x<screen->w;x++) {

            // Code to edit each pixel here.



I am migrating my code to work with SDL_Textures again, which requires using an SDL_Renderer. I am familiar with using SDL_RenderCopy and all of those functions, but I'm not sure how to go about editing the individual pixels rendered to an SDL_Renderer, and this is necessary. Does anyone have any suggestions on how to do this? Thanks!


SDL 2.0 - Double Screen Resolution

25 January 2014 - 10:46 PM

I'm unfortunately bringing this topic back from the dead (initially posted here: http://www.gamedev.net/topic/651375-double-screen-resolution/)


In favor of using SDL_BlitScaled, I migrated all of the code to SDL 2.0. Unfortunately, the slowdown is back again. How can I double the screen resolution so that every 1x1 pixel is a 2x2 pixel? I'm surprised that they still haven't implemented anything like this. It runs at full speed at the small resolution, but I would like for it to be double that without having to scale all of the graphics in advance, which will consume more ram.


Is there something that I am forgetting? Thanks!

SDL 2.0 - Enable VSync

20 January 2014 - 05:57 PM

The image that is the map tiles is approximately 11,000 pixels wide. When I load it into SDL_Texture with software rendering, it works. When I use this, however, it does not:

Using SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE without SDL_RENDERER_ACCELERATED also does not work. If I want the tiles to render, I must supply SDL_RENDERER_SOFTWARE only. How do I enable VSync in SDL 2.0 with software rendering, or why can I not store that as a texture in the GPU, yet I can store it in the CPU just fine?



Double Screen Resolution

19 December 2013 - 02:48 AM

Is there a way to use SDL_BlitSurface multiple times to SDL_Surface *screen, but, before doing SDL_Flip(screen);, doubling the resolution of it? My game is meant to look pixelated, so I know this will not increase the quality or anything. The rendering is small due to small tiles, though, so a way to double the scale of anything immediately before SDL_Flip(screen); would be helpful. I would increase the scale of all of the graphics, but that would take more space and some people may prefer a smaller screen resolution, so increasing the scale before flipping the surface sounds like the best option. I prefer to not use OpenGL nor SDL_gfx. Any input would be helpful! Thanks!