Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Wooh

Member Since 19 Dec 2008
Online Last Active Today, 03:06 AM

Posts I've Made

In Topic: Please help me with my menu

28 April 2015 - 02:03 AM

Maybe you could make the menu items move up and down, rotate and dance to the music. You probably shouldn't make them move too much because you probably don't want the menu to turn into a game where you have to concentrate to click the correct ones. Maybe the selected item could move less, or you could make sure that if the mouse is hovering the item it will dance in a way keeps the pointer approximately in the middle of the item.

In Topic: how to crop on SDL 1.2

28 April 2015 - 01:47 AM

The function you need to understand is the SDL_BlitSurface function.
int SDL_BlitSurface(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);
src (first argument) is the SDL_Surface that you want to draw on to some other surface.
srcrect (second argument) is the rectangle that you want to cut out of src surface.
dst (third argument) is the SDL_Surface that you want to draw the src surface on.
srcrect (third argument) will decide where on the dst it will draw.

// The surface that we want to draw
SDL_Surface* src = SDL_LoadBMP("img.bmp");

// The area that we want to draw from img.bmp.
SDL_Rect srcrect; // The area is ...
srcrect.w = 100;  // ... 100x100 pixels ...
srcrect.h = 100;  //
srcrect.x = 0;    // ... with the top left corner located at position (0,50)
srcrect.y = 50;   //

// The surface that we want draw on.
SDL_Surface* dst = SDL_GetVideoSurface(); // The screen surface

// The position on the screen where the top left corner of the cropped image will be drawn.
SDL_Rect dstrect;
dstrect.x = 10;
dstrect.y = 20;
// w and h will not be used by SDL_BlitSurface.

SDL_BlitSurface(src, &srcrect, dst, &dstrect);

In Topic: FastCall Is Alll

17 April 2015 - 03:14 AM

The true horror though is that a lot of these already *have* alternative tokens:

http://en.cppreference.com/w/cpp/language/operator_alternative


I tried some of these alternitives but it failed to compile (VS9)
You have to disable microsofts language extensions...
https://msdn.microsoft.com/en-us/library/34h23df8.aspx#sectionToggle9
https://msdn.microsoft.com/en-us/library/0k0w269d.aspx

In Topic: Solve this Logic Question...

16 April 2015 - 09:44 AM

Interesting problem, indeed. Took me while to figure it out.

In Topic: Template or Macro

15 April 2015 - 01:19 AM

I think you should prefer templates unless you have a good reason not to.

If you pass an array to SAFE_DELETE it will still compile, but using templates you can force this to give you an error.

int arr[5];
SAFE_DELETE(arr);

PARTNERS