22 #define NUM_SPRITES 100 26 #ifdef TEST_NATIVE_WINDOWS 27 &WindowsWindowFactory,
29 #ifdef TEST_NATIVE_X11 32 #ifdef TEST_NATIVE_COCOA 101 position = &positions[
i];
102 velocity = &velocities[
i];
103 position->
x += velocity->
x;
104 if ((position->
x < 0) || (position->
x >= (viewport.
w - sprite_w))) {
105 velocity->
x = -velocity->
x;
106 position->
x += velocity->
x;
108 position->
y += velocity->
y;
109 if ((position->
y < 0) || (position->
y >= (viewport.
h - sprite_h))) {
110 velocity->
y = -velocity->
y;
111 position->
y += velocity->
y;
145 for (i = 0; factories[
i]; ++
i) {
146 if (
SDL_strcmp(driver, factories[i]->tag) == 0) {
147 factory = factories[
i];
156 SDL_Log(
"Creating native window for %s driver\n", driver);
190 if (!positions || !velocities) {
196 positions[
i].
x = rand() % (window_w -
sprite_w);
197 positions[
i].
y = rand() % (window_h -
sprite_h);
202 while (!velocities[i].
x && !velocities[i].
y) {
213 switch (event.
type) {
SDL_Texture * LoadSprite(SDL_Renderer *renderer, char *file)
static NativeWindowFactory * factories[]
static SDL_Rect * positions
EGLSurface EGLnsecsANDROID time
#define SDL_LoadBMP(file)
GLint GLint GLint GLint GLint x
#define SDL_CreateWindowFrom
void(* DestroyNativeWindow)(void *window)
A collection of pixels used in software blitting.
EGLConfig void * native_window
void *(* CreateNativeWindow)(int w, int h)
#define SDL_GetWindowSize
#define SDL_CreateTextureFromSurface
void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite)
static SDL_Renderer * renderer
#define SDL_RenderGetViewport
GLint GLint GLint GLint GLint GLint y
#define SDL_SetWindowTitle
int main(int argc, char *argv[])
static void * native_window
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_LogSetPriority
#define SDL_GetCurrentVideoDriver
static NativeWindowFactory * factory
static SDL_Rect * velocities
EGLSurface EGLNativeWindowType * window
static SDL_Texture * sprite
The type used to identify a window.
#define SDL_SetRenderDrawColor
#define SDL_CreateRenderer
A rectangle, with the origin at the upper left.
#define SDL_RenderPresent