test/testdrawchessboard.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 17 Aug 2016 21:04:50 +0200
changeset 10275 ba7dc3ebb81e
parent 10132 b1e3eae293a2
permissions -rw-r--r--
Emscripten: Fixed opening previously closed joystick.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     1
/*
9998
f67cf37e9cd4 Updated copyright to 2016
Sam Lantinga <slouken@libsdl.org>
parents: 9922
diff changeset
     2
   Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     3
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     4
   This software is provided 'as-is', without any express or implied
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     5
   warranty.  In no event will the authors be held liable for any damages
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     6
   arising from the use of this software.
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     7
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     8
   Permission is granted to anyone to use this software for any purpose,
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
     9
   including commercial applications, and to alter it and redistribute it
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    10
   freely.
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    11
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    12
   This file is created by : Nitin Jain (nitin.j4@samsung.com)
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    13
*/
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    14
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    15
/* Sample program:  Draw a Chess Board  by using SDL_CreateSoftwareRenderer API */
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    16
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    17
#include <stdlib.h>
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    18
#include <stdio.h>
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    19
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    20
#ifdef __EMSCRIPTEN__
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    21
#include <emscripten/emscripten.h>
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    22
#endif
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    23
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    24
#include "SDL.h"
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    25
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    26
SDL_Window *window;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    27
SDL_Renderer *renderer;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    28
int done;
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    29
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    30
void
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    31
DrawChessBoard(SDL_Renderer * renderer)
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    32
{
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    33
    int row = 0,column = 0,x = 0;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    34
    SDL_Rect rect, darea;
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    35
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    36
    /* Get the Size of drawing surface */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    37
    SDL_RenderGetViewport(renderer, &darea);
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    38
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    39
    for( ; row < 8; row++)
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    40
    {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    41
        column = row%2;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    42
        x = column;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    43
        for( ; column < 4+(row%2); column++)
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    44
        {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    45
            SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    46
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    47
            rect.w = darea.w/8;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    48
            rect.h = darea.h/8;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    49
            rect.x = x * rect.w;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    50
            rect.y = row * rect.h;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    51
            x = x + 2;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    52
            SDL_RenderFillRect(renderer, &rect);
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    53
        }
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    54
    }
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    55
}
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    56
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    57
void
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    58
loop()
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    59
{
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    60
    SDL_Event e;
9605
be71aef6c347 Fixed handling only one event per frame in test program.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
    61
    while (SDL_PollEvent(&e)) {
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    62
        if (e.type == SDL_QUIT) {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    63
            done = 1;
9607
7746ab058d12 Added missing loop cancel for Emscripten in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9605
diff changeset
    64
#ifdef __EMSCRIPTEN__
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    65
            emscripten_cancel_main_loop();
9607
7746ab058d12 Added missing loop cancel for Emscripten in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9605
diff changeset
    66
#endif
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    67
            return;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    68
        }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    69
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    70
        if ((e.type == SDL_KEYDOWN) && (e.key.keysym.sym == SDLK_ESCAPE)) {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    71
            done = 1;
9607
7746ab058d12 Added missing loop cancel for Emscripten in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9605
diff changeset
    72
#ifdef __EMSCRIPTEN__
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    73
            emscripten_cancel_main_loop();
9607
7746ab058d12 Added missing loop cancel for Emscripten in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9605
diff changeset
    74
#endif
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    75
            return;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    76
        }
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    77
    }
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    78
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    79
    DrawChessBoard(renderer);
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    80
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    81
    /* Got everything on rendering surface,
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    82
       now Update the drawing image on window screen */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    83
    SDL_UpdateWindowSurface(window);
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    84
}
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
    85
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    86
int
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    87
main(int argc, char *argv[])
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    88
{
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    89
    SDL_Surface *surface;
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    90
7639
9406b7dd2f2d Fix bug 2034: replace printf by SDL_Log in tests; update loopwave VS solution: copy missing dependency
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 7541
diff changeset
    91
    /* Enable standard application logging */
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    92
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
    93
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    94
    /* Initialize SDL */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    95
    if(SDL_Init(SDL_INIT_VIDEO) != 0)
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    96
    {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    97
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    98
        return 1;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
    99
    }
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   100
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   101
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   102
    /* Create window and renderer for given surface */
10132
b1e3eae293a2 Removed not needed SDL_WINDOW_SHOWN from chessboard test program.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9998
diff changeset
   103
    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   104
    if(!window)
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   105
    {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   106
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   107
        return 1;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   108
    }
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   109
    surface = SDL_GetWindowSurface(window);
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   110
    renderer = SDL_CreateSoftwareRenderer(surface);
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   111
    if(!renderer)
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   112
    {
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   113
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   114
        return 1;
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   115
    }
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   116
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   117
    /* Clear the rendering surface with the specified color */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   118
    SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   119
    SDL_RenderClear(renderer);
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   120
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   121
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   122
    /* Draw the Image on rendering surface */
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   123
    done = 0;
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   124
#ifdef __EMSCRIPTEN__
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   125
    emscripten_set_main_loop(loop, 0, 1);
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   126
#else
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   127
    while (!done) {
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   128
        loop();
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   129
    }
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents: 9105
diff changeset
   130
#endif
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   131
9836
3d43bb56c5d6 Added missing SDL_Quit() in test program.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9703
diff changeset
   132
    SDL_Quit();
9922
b066d5fd5fa7 Replaced tabs with spaces in test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9836
diff changeset
   133
    return 0;
7905
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   134
}
586eddae6340 Fixed bug 2190 - test/testdrawchessboard.c line endings
Sam Lantinga <slouken@libsdl.org>
parents: 7639
diff changeset
   135