Why?

#include <stdio.h>
#include <windows.h>
#include <SDL.h>
#include
using namespace std;

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

cout<<“Initializing SDL.\n”;
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
exit(1);
}
cout<<“SDL initialized.\n”;
cout<<“Quiting SDL.\n”;
SDL_Quit();
cout<<“Quiting…\n”;
exit(0);
SDL_Surface *SDL_SetVideoMode(640, 480, 24, SDL_FULLSCREEN|SDL_SURFACE);

typedef struct SDL_Surface
{
Uint32 flags;
SDL_PixelFormat *format;
int w, h;
Uint16 pitch;
void *pixels;
SDL_Rect clip_rect;
int refcount;
} SDL_Surface;
}

When i try to compile this code it gives me an error:

Compiling…
1.cpp
C:\1.cpp(20) : error C2059: syntax error : 'constant’
Error executing cl.exe.

1.exe - 1 error(s), 0 warning(s)

I don’t know why i get this error but if you know can you help me a lil
plz?
Thx

-SqRu

The above doesn’t look right. What exactly are you trying to do there?On Tue, 2002-09-24 at 12:20, Anssi Kostamo Kitee wrote:

SDL_Surface *SDL_SetVideoMode(640, 480, 24, SDL_FULLSCREEN|SDL_SURFACE);

You haven’t declared SDL_Surface before you use it. Move the
typedef up before main().

By the way, the old
typedef struct Name { } Name;
trick isn’t necessary in C++.

You can just say:
struct Name { };
and have the same result.

Kent

Tuesday, September 24, 2002, 1:20:12 PM, Anssi wrote:> #include <stdio.h>

#include <windows.h>
#include <SDL.h>
#include
using namespace std;

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

cout<<“Initializing SDL.\n”;
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
exit(1);
}
cout<<“SDL initialized.\n”;
cout<<“Quiting SDL.\n”;
SDL_Quit();
cout<<“Quiting…\n”;
exit(0);
SDL_Surface *SDL_SetVideoMode(640, 480, 24, SDL_FULLSCREEN|SDL_SURFACE);

typedef struct SDL_Surface
{
Uint32 flags;
SDL_PixelFormat *format;
int w, h;
Uint16 pitch;
void *pixels;
SDL_Rect clip_rect;
int refcount;
} SDL_Surface;
}

When i try to compile this code it gives me an error:

Compiling…
1.cpp
C:\1.cpp(20) : error C2059: syntax error : 'constant’
Error executing cl.exe.

1.exe - 1 error(s), 0 warning(s)

I don’t know why i get this error but if you know can you help me a lil
plz?
Thx

-SqRu


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Kent Quirk, CTO, CogniToy
@Kent_Quirk
http://www.cognitoy.com

If you are including SDL.h, you should not have to define the
SDL_Surface structure as it is included in the SDL.h include. I would
remove that portion altogether.

Jason> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org] On Behalf Of
Kent Quirk
Sent: Wednesday, September 25, 2002 8:42 AM
To: sdl at libsdl.org
Subject: Re: [SDL] Why?

You haven’t declared SDL_Surface before you use it. Move the typedef up
before main().

By the way, the old
typedef struct Name { } Name;
trick isn’t necessary in C++.

You can just say:
struct Name { };
and have the same result.

Kent

Tuesday, September 24, 2002, 1:20:12 PM, Anssi wrote:

#include <stdio.h>
#include <windows.h>
#include <SDL.h>
#include
using namespace std;

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

cout<<“Initializing SDL.\n”;
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf(“Could not initialize SDL: %s.\n”, SDL_GetError());
exit(1);
}
cout<<“SDL initialized.\n”;
cout<<“Quiting SDL.\n”;
SDL_Quit();
cout<<“Quiting…\n”;
exit(0);
SDL_Surface *SDL_SetVideoMode(640, 480, 24,
SDL_FULLSCREEN|SDL_SURFACE);

typedef struct SDL_Surface
{
Uint32 flags;
SDL_PixelFormat *format;
int w, h;
Uint16 pitch;
void *pixels;
SDL_Rect clip_rect;
int refcount;
} SDL_Surface;
}

When i try to compile this code it gives me an error:

Compiling…
1.cpp
C:\1.cpp(20) : error C2059: syntax error : 'constant’
Error executing cl.exe.

1.exe - 1 error(s), 0 warning(s)

I don’t know why i get this error but if you know can you help me a
lil plz? Thx

-SqRu


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Kent Quirk, CTO, CogniToy
kent_quirk at cognitoy.com
http://www.cognitoy.com


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi,
Is there any way to stretch (resize) an SDL Surface?
It is quite usefull for making a surface combatible for usage as an
openGL texture which is not power of two.

Thanks in advance

Hiya,

AKK> SDL_Surface *SDL_SetVideoMode(640, 480, 24, SDL_FULLSCREEN|SDL_SURFACE);

You’re trying to declare a function in main() which isn’t a good idea.
I suspect what you want to do is:

SDL_Surface *screen = SDL_SetVideoMode(640, 480, 24, SDL_FULLSCREEN|SDL_SURFACE);

AKK> typedef struct SDL_Surface
AKK> {
AKK> Uint32 flags;
AKK> SDL_PixelFormat *format;
AKK> int w, h;
AKK> Uint16 pitch;
AKK> void *pixels;
AKK> SDL_Rect clip_rect;
AKK> int refcount;
AKK> } SDL_Surface;

If you’re including the SDL header, you shouldn’t need to do this.

Neil.

Some texture resampling code for resampling – BSD license:

http://zerowing.idsoftware.com/viewcvs/viewcvs.cgi/checkout/GtkRadiant/radiant/texmanip.cpp?rev=1.1&content-type=text/plain

Example of how to use it (don’t copy and paste this code, just read it
to see how to use the resampling code – iD Software License):

Look for this function:
QERApp_LoadTextureRGBA

In this link:
http://zerowing.idsoftware.com/viewcvs/viewcvs.cgi/checkout/GtkRadiant/radiant/texwindow.cpp?rev=1.41.2.16&only_with_tag=Stable-1_2&content-type=text/plain

That’s the way I do it for GtkRadiant, to resample textures to a power
of 2 size. I’m sure it could be done better. But that works quite well.On Wed, 2002-09-25 at 10:42, Vasileiou Nikolaos wrote:

Hi,
Is there any way to stretch (resize) an SDL Surface?
It is quite usefull for making a surface combatible for usage as an
openGL texture which is not power of two.

My that was redundantly redundant. Anyway, you can adapt the code I
mentioned to resize the texture with very little loss if you use it the
same way I do in the code I linked…On Wed, 2002-09-25 at 13:27, DrEvil wrote:

On Wed, 2002-09-25 at 10:42, Vasileiou Nikolaos wrote:

Hi,
Is there any way to stretch (resize) an SDL Surface?
It is quite usefull for making a surface combatible for usage as an
openGL texture which is not power of two.

Some texture resampling code for resampling – BSD license:

Thanks alotOn 25 Sep 2002, DrEvil wrote:

On Wed, 2002-09-25 at 10:42, Vasileiou Nikolaos wrote:

Hi,
Is there any way to stretch (resize) an SDL Surface?
It is quite usefull for making a surface combatible for usage as an
openGL texture which is not power of two.

Some texture resampling code for resampling – BSD license:

http://zerowing.idsoftware.com/viewcvs/viewcvs.cgi/checkout/GtkRadiant/radiant/texmanip.cpp?rev=1.1&content-type=text/plain

Example of how to use it (don’t copy and paste this code, just read it
to see how to use the resampling code – iD Software License):

Look for this function:
QERApp_LoadTextureRGBA

In this link:
http://zerowing.idsoftware.com/viewcvs/viewcvs.cgi/checkout/GtkRadiant/radiant/texwindow.cpp?rev=1.41.2.16&only_with_tag=Stable-1_2&content-type=text/plain

That’s the way I do it for GtkRadiant, to resample textures to a power
of 2 size. I’m sure it could be done better. But that works quite well.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl