WinRT: merged with SDL 2.0.1 codebase

This commit is contained in:
David Ludwig 2013-10-27 21:26:46 -04:00
commit 59df93166d
344 changed files with 12745 additions and 7248 deletions

View file

@ -31,19 +31,19 @@ static SDL_Texture *ship = 0; /* texture for spaceship */
static SDL_Texture *space = 0; /* texture for space (background */
void
render(SDL_Renderer *renderer)
render(SDL_Renderer *renderer, int w, int h)
{
/* get joystick (accelerometer) axis values and normalize them */
float ax = SDL_JoystickGetAxis(accelerometer, 0);
float ay = -SDL_JoystickGetAxis(accelerometer, 1);
float ay = SDL_JoystickGetAxis(accelerometer, 1);
/* ship screen constraints */
Uint32 minx = 0.0f;
Uint32 maxx = SCREEN_WIDTH - shipData.rect.w;
Uint32 maxx = w - shipData.rect.w;
Uint32 miny = 0.0f;
Uint32 maxy = SCREEN_HEIGHT - shipData.rect.h;
Uint32 maxy = h - shipData.rect.h;
#define SINT16_MAX ((float)(0x7FFF))
@ -162,8 +162,9 @@ main(int argc, char *argv[])
SDL_Renderer *renderer;
Uint32 startFrame; /* time frame began to process */
Uint32 endFrame; /* time frame ended processing */
Uint32 delay; /* time to pause waiting to draw next frame */
Sint32 delay; /* time to pause waiting to draw next frame */
int done; /* should we clean up and exit? */
int w, h;
/* initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
@ -173,8 +174,10 @@ main(int argc, char *argv[])
/* create main window and renderer */
window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_OPENGL |
SDL_WINDOW_BORDERLESS);
SDL_WINDOW_FULLSCREEN);
renderer = SDL_CreateRenderer(window, 0, 0);
SDL_GetWindowSize(window, &w, &h);
/* print out some info about joysticks and try to open accelerometer for use */
printf("There are %d joysticks available\n", SDL_NumJoysticks());
@ -196,8 +199,8 @@ main(int argc, char *argv[])
initializeTextures(renderer);
/* setup ship */
shipData.x = (SCREEN_WIDTH - shipData.rect.w) / 2;
shipData.y = (SCREEN_HEIGHT - shipData.rect.h) / 2;
shipData.x = (w - shipData.rect.w) / 2;
shipData.y = (h - shipData.rect.h) / 2;
shipData.vx = 0.0f;
shipData.vy = 0.0f;
@ -211,7 +214,7 @@ main(int argc, char *argv[])
done = 1;
}
}
render(renderer);
render(renderer, w, h);
endFrame = SDL_GetTicks();
/* figure out how much time we have left, and then sleep */

View file

@ -196,7 +196,7 @@ explodeEmitter(struct particle *emitter)
float speed = randomFloat(0.00, powf(0.17, exponent));
speed = powf(speed, 1.0f / exponent);
/*select the particle at the end of our array */
/* select the particle at the end of our array */
struct particle *p = &particles[num_active_particles];
/* set the particles properties */

View file

@ -80,7 +80,7 @@ fontMapping map[TABLE_SIZE] = {
{SDL_SCANCODE_7, 1, 0, 23}, /* 7 */
{SDL_SCANCODE_8, 1, 0, 24}, /* 8 */
{SDL_SCANCODE_9, 1, 0, 25}, /* 9 */
{SDL_SCANCODE_SPACE, 1, 0, 0}, /*' ' */
{SDL_SCANCODE_SPACE, 1, 0, 0}, /* ' ' */
{SDL_SCANCODE_1, 0, KMOD_SHIFT, 1}, /* ! */
{SDL_SCANCODE_SLASH, 0, KMOD_SHIFT, 31}, /* ? */
{SDL_SCANCODE_SLASH, 1, 0, 15}, /* / */

View file

@ -37,7 +37,7 @@ render(SDL_Renderer *renderer)
int
main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_VIDEO/* | SDL_INIT_AUDIO*/) < 0)
if (SDL_Init(SDL_INIT_VIDEO/* | SDL_INIT_AUDIO */) < 0)
{
printf("Unable to initialize SDL");
}

View file

@ -92,7 +92,7 @@ main(int argc, char *argv[])
SDL_WINDOW_BORDERLESS);
renderer = SDL_CreateRenderer(window, 0, 0);
/*load brush texture */
/* load brush texture */
initializeTexture(renderer);
/* fill canvass initially with all black */

View file

@ -67,6 +67,8 @@
04F7808512FB753F00FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */; };
04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8912E23B8D00BA343D /* SDL_atomic.c */; };
04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */; };
56C181DF17C44D5E00406AE3 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */; };
56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */; };
56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */; };
56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */; };
56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
@ -258,6 +260,8 @@
04F7808312FB753F00FC43C0 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullframebuffer.c; sourceTree = "<group>"; };
04FFAB8912E23B8D00BA343D /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = "<group>"; };
04FFAB8A12E23B8D00BA343D /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = "<group>"; };
56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = "<group>"; };
56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = "<group>"; };
56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_coreaudio.c; path = coreaudio/SDL_coreaudio.c; sourceTree = "<group>"; };
56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_coreaudio.h; path = coreaudio/SDL_coreaudio.h; sourceTree = "<group>"; };
56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = ../../src/power/SDL_power.c; sourceTree = SOURCE_ROOT; };
@ -549,6 +553,14 @@
sourceTree = "<group>";
usesTabs = 0;
};
56C181E017C44D6900406AE3 /* filesystem */ = {
isa = PBXGroup;
children = (
56C181E117C44D7A00406AE3 /* SDL_sysfilesystem.m */,
);
name = filesystem;
sourceTree = "<group>";
};
56EA86F813E9EBF9002E47EB /* coreaudio */ = {
isa = PBXGroup;
children = (
@ -677,6 +689,7 @@
AA7558701595D55500BBD41B /* SDL_endian.h */,
AA7558711595D55500BBD41B /* SDL_error.h */,
AA7558721595D55500BBD41B /* SDL_events.h */,
56C181DE17C44D5E00406AE3 /* SDL_filesystem.h */,
AA0AD06416647BD400CE5896 /* SDL_gamecontroller.h */,
AA7558731595D55500BBD41B /* SDL_gesture.h */,
AA7558741595D55500BBD41B /* SDL_haptic.h */,
@ -727,6 +740,7 @@
FD99B98A0DD52EDC00FB1D6B /* cpuinfo */,
FD99B98C0DD52EDC00FB1D6B /* events */,
FD99B99D0DD52EDC00FB1D6B /* file */,
56C181E017C44D6900406AE3 /* filesystem */,
047677B60EA769DF008ABAF1 /* haptic */,
FD5F9D080E0E08B3008E885B /* joystick */,
FD8BD8150E27E25900B52CD5 /* loadso */,
@ -1019,6 +1033,7 @@
AABCC3941640643D00AB8930 /* SDL_uikitmessagebox.h in Headers */,
AA0AD06516647BD400CE5896 /* SDL_gamecontroller.h in Headers */,
AADA5B8F16CCAB7C00107CF7 /* SDL_bits.h in Headers */,
56C181DF17C44D5E00406AE3 /* SDL_filesystem.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1184,6 +1199,7 @@
AABCC3951640643D00AB8930 /* SDL_uikitmessagebox.m in Sources */,
AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */,
AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */,
56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};