3 Replies - 1808 Views - Last Post: 18 November 2012 - 09:17 PM Rate Topic: -----

#1 Episkopos86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-November 12

Loading images - "error C2660: function [ ] does not take 6 argume

Posted 17 November 2012 - 08:43 PM

Good evening, this is my first time here so I apologize if I break any rules, please correct me and I will learn.
I am attempting to teach myself C++ and SDL and I am still very green; my first roadblock has come up and I would appreciate some education please.

The objective of the code is to create a window with two images.
Using Microsoft Visual C++ Express, I am running into the error message-

"error C2660: 'SDL_UpperBlit' : function does not take 6 arguments"

#pragma comment(lib, "SDL.lib")
#pragma comment(lib, "SDLmain.lib")
#pragma comment(lib, "SDL_TTF.lib")

#include "SDL.h"
#include "SDL_image.h"
#include <iostream>
#include <stack>
#include <string>
#include "SDL_TTF.h"
#include "Defines.h"

using namespace std;

int main(int argc, char *argv[])


{
const int SCREEN_WIDTH = 644;
const int SCREEN_HEIGHT = 400;
const int SCREEN_BPP = 32;

SDL_Surface *logo = NULL;
SDL_Surface *border = NULL;
SDL_Surface *screen = NULL;

SDL_Init(SDL_INIT_EVERYTHING);

SDL_WM_SetCaption("Name", NULL);

screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
border = IMG_Load("Graphics/Title/Border.png");
logo = IMG_Load("Graphics/Title/Logo.png");

SDL_BlitSurface( logo, NULL, border, NULL, screen, NULL );

SDL_Flip(screen);
SDL_Delay(5000);
SDL_FreeSurface(logo);
SDL_FreeSurface(border);

SDL_Quit();
return 0;
}




If the line-
SDL_BlitSurface( logo, NULL, border, NULL, screen, NULL );

is changed to-
SDL_BlitSurface( border, NULL, screen, NULL );

or-
SDL_BlitSurface( logo, NULL, screen, NULL );

it will display one of the images with no problems at all. However I cannot find out how to make it show both images at once and avoid the above error message.

Also please feel free to let me know if I have any code that I do not need.

Thank you for your time.
Best regards,

Dan

Is This A Good Question/Topic? 0
  • +

Replies To: Loading images - "error C2660: function [ ] does not take 6 argume

#2 AKMafia001  Icon User is offline

  • </code.in.dream>

Reputation: 187
  • View blog
  • Posts: 624
  • Joined: 11-June 11

Re: Loading images - "error C2660: function [ ] does not take 6 argume

Posted 18 November 2012 - 05:02 AM

The function SDL_BlitSurface() takes only 4 arguments. I think you need to call it twice, and if things don't go well, then check out the 4th argument:
SDL_Rect*       dstrect | the SDL_Rect structure representing the rectangle that is copied into


Hope this Helps!
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,437
  • Joined: 23-August 08

Re: Loading images - "error C2660: function [ ] does not take 6 argume

Posted 18 November 2012 - 09:48 AM

You are biting off more than you can chew if you're trying to learn C++ and an external graphics library at the same time. Learn C++ FIRST, then move on to bigger and better things.g
Was This Post Helpful? 0
  • +
  • -

#4 Episkopos86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-November 12

Re: Loading images - "error C2660: function [ ] does not take 6 argume

Posted 18 November 2012 - 09:17 PM

AKMafia001- Thank you, you were totally correct, I rewrote the code as:

SDL_BlitSurface(logo,NULL,screen,NULL);
SDL_BlitSurface(border,NULL,screen,NULL);



And I got both images.


JackOfAllTrades- I appreciate your guidance, and will try to focus more on the basics.

Thank you for your time both of you.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1