test/testoverlay2.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 20 Jul 2013 21:47:16 +0200
changeset 7478 0d02f6a323f5
parent 6256 1d905b13b102
child 7504 5a45a9536a65
permissions -rw-r--r--
Removed not needed SDL_WINDOW_SHOWN from test programs. See bug #1667.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     1
/*
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     2
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     3
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     4
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     5
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     6
  arising from the use of this software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     7
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     8
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
     9
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
    10
  freely.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5357
diff changeset
    11
*/
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
/********************************************************************************
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    13
 *                                                                              *
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
 * Test of the overlay used for moved pictures, test more closed to real life.  *
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
 * Running trojan moose :) Coded by Mike Gorchak.                               *
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
 *                                                                              *
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
 ********************************************************************************/
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
6256
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    19
#if 1 /* FIXME: Rework this using the 2.0 API */
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    20
#include <stdio.h>
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    21
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    22
int main(int argc, char *argv[])
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    23
{
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    24
    printf("FIXME\n");
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    25
    return 0;
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    26
}
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
    27
#else
1030
6b8f0543337c Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents: 886
diff changeset
    28
#include <stdlib.h>
6b8f0543337c Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents: 886
diff changeset
    29
#include <stdio.h>
6b8f0543337c Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents: 886
diff changeset
    30
#include <string.h>
6b8f0543337c Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents: 886
diff changeset
    31
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
#include "SDL.h"
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
#define MOOSEPIC_W 64
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
#define MOOSEPIC_H 88
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
#define MOOSEFRAME_SIZE (MOOSEPIC_W * MOOSEPIC_H)
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
#define MOOSEFRAMES_COUNT 10
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    40
SDL_Color MooseColors[84] = {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    41
    {49, 49, 49}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    42
    , {66, 24, 0}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    43
    , {66, 33, 0}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    44
    , {66, 66, 66}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    45
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    46
    {66, 115, 49}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    47
    , {74, 33, 0}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    48
    , {74, 41, 16}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    49
    , {82, 33, 8}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    50
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    51
    {82, 41, 8}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    52
    , {82, 49, 16}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    53
    , {82, 82, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    54
    , {90, 41, 8}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    55
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    56
    {90, 41, 16}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    57
    , {90, 57, 24}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    58
    , {99, 49, 16}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    59
    , {99, 66, 24}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    60
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    61
    {99, 66, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    62
    , {99, 74, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    63
    , {107, 57, 24}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    64
    , {107, 82, 41}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    65
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    66
    {115, 57, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    67
    , {115, 66, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    68
    , {115, 66, 41}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    69
    , {115, 74, 0}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    70
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    71
    {115, 90, 49}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    72
    , {115, 115, 115}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    73
    , {123, 82, 0}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    74
    , {123, 99, 57}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    75
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    76
    {132, 66, 41}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    77
    , {132, 74, 41}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    78
    , {132, 90, 8}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    79
    , {132, 99, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    80
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    81
    {132, 99, 66}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    82
    , {132, 107, 66}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    83
    , {140, 74, 49}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    84
    , {140, 99, 16}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    85
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    86
    {140, 107, 74}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    87
    , {140, 115, 74}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    88
    , {148, 107, 24}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    89
    , {148, 115, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    90
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    91
    {148, 123, 74}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    92
    , {148, 123, 90}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    93
    , {156, 115, 33}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    94
    , {156, 115, 90}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    95
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    96
    {156, 123, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    97
    , {156, 132, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    98
    , {156, 132, 99}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
    99
    , {156, 156, 156}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   100
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   101
    {165, 123, 49}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   102
    , {165, 123, 90}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   103
    , {165, 132, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   104
    , {165, 132, 90}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   105
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   106
    {165, 132, 99}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   107
    , {165, 140, 90}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   108
    , {173, 132, 57}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   109
    , {173, 132, 99}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   110
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   111
    {173, 140, 107}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   112
    , {173, 140, 115}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   113
    , {173, 148, 99}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   114
    , {173, 173, 173}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   115
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   116
    {181, 140, 74}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   117
    , {181, 148, 115}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   118
    , {181, 148, 123}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   119
    , {181, 156, 107}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   120
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   121
    {189, 148, 123}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   122
    , {189, 156, 82}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   123
    , {189, 156, 123}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   124
    , {189, 156, 132}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   125
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   126
    {189, 189, 189}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   127
    , {198, 156, 123}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   128
    , {198, 165, 132}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   129
    , {206, 165, 99}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   130
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   131
    {206, 165, 132}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   132
    , {206, 173, 140}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   133
    , {206, 206, 206}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   134
    , {214, 173, 115}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   135
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   136
    {214, 173, 140}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   137
    , {222, 181, 148}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   138
    , {222, 189, 132}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   139
    , {222, 189, 156}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   140
    ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   141
    {222, 222, 222}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   142
    , {231, 198, 165}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   143
    , {231, 231, 231}
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   144
    , {239, 206, 173}
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
};
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   147
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   148
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   149
static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   150
quit(int rc)
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   151
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   152
    SDL_Quit();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   153
    exit(rc);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   154
}
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   155
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   156
/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   157
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
/* NOTE: These RGB conversion functions are not intended for speed,
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
         only as examples.
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
*/
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   162
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   163
RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   165
    if (monochrome) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   166
#if 1                           /* these are the two formulas that I found on the FourCC site... */
4884
27ab20a36eba - added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 2267
diff changeset
   167
        yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   168
        yuv[1] = 128;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
        yuv[2] = 128;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
#else
4884
27ab20a36eba - added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 2267
diff changeset
   171
        yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   172
        yuv[1] = 128;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   173
        yuv[2] = 128;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   174
#endif
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   175
    } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   176
#if 1                           /* these are the two formulas that I found on the FourCC site... */
4884
27ab20a36eba - added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 2267
diff changeset
   177
        yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]);
27ab20a36eba - added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 2267
diff changeset
   178
        yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128);
27ab20a36eba - added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents: 2267
diff changeset
   179
        yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   180
#else
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   181
        yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   182
        yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   183
        yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   184
#endif
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   185
    }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   187
    if (luminance != 100) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   188
        yuv[0] = yuv[0] * luminance / 100;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   189
        if (yuv[0] > 255)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   190
            yuv[0] = 255;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
    }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   194
void
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   195
ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h,
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   196
                 int monochrome, int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   198
    int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   199
    int yuv[3];
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   200
    Uint8 *op[3];
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   201
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   202
    op[0] = out;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   203
    op[1] = op[0] + w*h;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   204
    op[2] = op[1] + w*h/4;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   205
    for (y = 0; y < h; ++y) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   206
        for (x = 0; x < w; ++x) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   207
            RGBtoYUV(rgb, yuv, monochrome, luminance);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   208
            *(op[0]++) = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   209
            if (x % 2 == 0 && y % 2 == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   210
                *(op[1]++) = yuv[2];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   211
                *(op[2]++) = yuv[1];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   212
            }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   213
            rgb += 3;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   214
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   215
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   216
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   217
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   218
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   219
ConvertRGBtoIYUV(SDL_Surface * s, SDL_Overlay * o, int monochrome,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   220
                 int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   221
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   222
    int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   223
    int yuv[3];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   224
    Uint8 *p, *op[3];
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   225
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   226
    SDL_LockSurface(s);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   227
    SDL_LockYUVOverlay(o);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   228
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   229
    /* Convert */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   230
    for (y = 0; y < s->h && y < o->h; y++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   231
        p = ((Uint8 *) s->pixels) + s->pitch * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   232
        op[0] = o->pixels[0] + o->pitches[0] * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   233
        op[1] = o->pixels[1] + o->pitches[1] * (y / 2);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   234
        op[2] = o->pixels[2] + o->pitches[2] * (y / 2);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   235
        for (x = 0; x < s->w && x < o->w; x++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   236
            RGBtoYUV(p, yuv, monochrome, luminance);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   237
            *(op[0]++) = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   238
            if (x % 2 == 0 && y % 2 == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   239
                *(op[1]++) = yuv[1];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   240
                *(op[2]++) = yuv[2];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   241
            }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   242
            p += s->format->BytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   243
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   244
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   245
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   246
    SDL_UnlockYUVOverlay(o);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   247
    SDL_UnlockSurface(s);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   248
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   249
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   250
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   251
ConvertRGBtoUYVY(SDL_Surface * s, SDL_Overlay * o, int monochrome,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   252
                 int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   253
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   254
    int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   255
    int yuv[3];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   256
    Uint8 *p, *op;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   257
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   258
    SDL_LockSurface(s);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   259
    SDL_LockYUVOverlay(o);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   260
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   261
    for (y = 0; y < s->h && y < o->h; y++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   262
        p = ((Uint8 *) s->pixels) + s->pitch * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   263
        op = o->pixels[0] + o->pitches[0] * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   264
        for (x = 0; x < s->w && x < o->w; x++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   265
            RGBtoYUV(p, yuv, monochrome, luminance);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   266
            if (x % 2 == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   267
                *(op++) = yuv[1];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   268
                *(op++) = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   269
                *(op++) = yuv[2];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   270
            } else
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   271
                *(op++) = yuv[0];
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   272
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   273
            p += s->format->BytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   274
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   275
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   276
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   277
    SDL_UnlockYUVOverlay(o);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   278
    SDL_UnlockSurface(s);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   279
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   280
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   281
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   282
ConvertRGBtoYVYU(SDL_Surface * s, SDL_Overlay * o, int monochrome,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   283
                 int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   284
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   285
    int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   286
    int yuv[3];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   287
    Uint8 *p, *op;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   288
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   289
    SDL_LockSurface(s);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   290
    SDL_LockYUVOverlay(o);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   291
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   292
    for (y = 0; y < s->h && y < o->h; y++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   293
        p = ((Uint8 *) s->pixels) + s->pitch * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   294
        op = o->pixels[0] + o->pitches[0] * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   295
        for (x = 0; x < s->w && x < o->w; x++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   296
            RGBtoYUV(p, yuv, monochrome, luminance);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   297
            if (x % 2 == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   298
                *(op++) = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   299
                *(op++) = yuv[2];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   300
                op[1] = yuv[1];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   301
            } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   302
                *op = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   303
                op += 2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   304
            }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   305
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   306
            p += s->format->BytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   307
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   308
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   309
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   310
    SDL_UnlockYUVOverlay(o);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   311
    SDL_UnlockSurface(s);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   312
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   313
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   314
void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   315
ConvertRGBtoYUY2(SDL_Surface * s, SDL_Overlay * o, int monochrome,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   316
                 int luminance)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   317
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   318
    int x, y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   319
    int yuv[3];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   320
    Uint8 *p, *op;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   321
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   322
    SDL_LockSurface(s);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   323
    SDL_LockYUVOverlay(o);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   324
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   325
    for (y = 0; y < s->h && y < o->h; y++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   326
        p = ((Uint8 *) s->pixels) + s->pitch * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   327
        op = o->pixels[0] + o->pitches[0] * y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   328
        for (x = 0; x < s->w && x < o->w; x++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   329
            RGBtoYUV(p, yuv, monochrome, luminance);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   330
            if (x % 2 == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   331
                *(op++) = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   332
                *(op++) = yuv[1];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   333
                op[1] = yuv[2];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   334
            } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   335
                *op = yuv[0];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   336
                op += 2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   337
            }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   338
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   339
            p += s->format->BytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   340
        }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   341
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   342
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   343
    SDL_UnlockYUVOverlay(o);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   344
    SDL_UnlockSurface(s);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   345
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   346
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   347
static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   348
PrintUsage(char *argv0)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   349
{
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   350
    fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0);
886
05c551e5bc64 Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 753
diff changeset
   351
    fprintf(stderr, "\n");
05c551e5bc64 Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 753
diff changeset
   352
    fprintf(stderr, "Where 'arg' is any of the following options:\n");
05c551e5bc64 Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 753
diff changeset
   353
    fprintf(stderr, "\n");
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   354
    fprintf(stderr, "    -fps <frames per second>\n");
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   355
    fprintf(stderr, "    -nodelay\n");
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   356
    fprintf(stderr, "    -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   357
    fprintf(stderr, "    -scale <scale factor> (initial scale of the overlay)\n");
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   358
    fprintf(stderr, "    -help (shows this help)\n");
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   359
    fprintf(stderr, "\n");
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   360
    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   361
            "Press ESC to exit, or SPACE to freeze the movie while application running.\n");
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   362
    fprintf(stderr, "\n");
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   363
}
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   364
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   365
int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   366
main(int argc, char **argv)
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   367
{
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   368
    Uint8 *RawMooseData;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   369
    SDL_RWops *handle;
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   370
    int window_w;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   371
    int window_h;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   372
    SDL_Window *window;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   373
    SDL_Renderer *renderer;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   374
    Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE*2];
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   375
    SDL_Texture *MooseTexture;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   376
    SDL_Rect displayrect;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   377
    SDL_Event event;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   378
    int paused = 0;
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   379
    int i, j;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   380
    int fps = 12;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   381
    int fpsdelay;
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   382
    int nodelay = 0;
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   383
    Uint32 pixel_format = SDL_PIXELFORMAT_YV12;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   384
    int scale = 5;
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   385
    SDL_bool done = SDL_FALSE;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   386
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   387
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   388
        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   389
        return 3;
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   390
    }
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   391
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   392
    while (argc > 1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   393
        if (strcmp(argv[1], "-fps") == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   394
            if (argv[2]) {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   395
                fps = atoi(argv[2]);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   396
                if (fps == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   397
                    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   398
                            "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   399
                    quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   400
                }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   401
                if ((fps < 0) || (fps > 1000)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   402
                    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   403
                            "The -fps option must be in range from 1 to 1000, default is 12.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   404
                    quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   405
                }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   406
                argv += 2;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   407
                argc -= 2;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   408
            } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   409
                fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   410
                        "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   411
                quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   412
            }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   413
        } else if (strcmp(argv[1], "-nodelay") == 0) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   414
            nodelay = 1;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   415
            argv += 1;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   416
            argc -= 1;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   417
        } else if (strcmp(argv[1], "-format") == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   418
            if (argv[2]) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   419
                if (!strcmp(argv[2], "YV12"))
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   420
                    pixel_format = SDL_PIXELFORMAT_YV12;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   421
                else if (!strcmp(argv[2], "IYUV"))
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   422
                    pixel_format = SDL_PIXELFORMAT_IYUV;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   423
                else if (!strcmp(argv[2], "YUY2"))
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   424
                    pixel_format = SDL_PIXELFORMAT_YUY2;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   425
                else if (!strcmp(argv[2], "UYVY"))
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   426
                    pixel_format = SDL_PIXELFORMAT_UYVY;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   427
                else if (!strcmp(argv[2], "YVYU"))
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   428
                    pixel_format = SDL_PIXELFORMAT_YVYU;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   429
                else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   430
                    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   431
                            "The -format option %s is not recognized, see help for info.\n",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   432
                            argv[2]);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   433
                    quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   434
                }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   435
                argv += 2;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   436
                argc -= 2;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   437
            } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   438
                fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   439
                        "The -format option requires an argument, default is YUY2.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   440
                quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   441
            }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   442
        } else if (strcmp(argv[1], "-scale") == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   443
            if (argv[2]) {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   444
                scale = atoi(argv[2]);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   445
                if (scale == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   446
                    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   447
                            "The -scale option requires an argument [from 1 to 50], default is 5.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   448
                    quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   449
                }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   450
                if ((scale < 0) || (scale > 50)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   451
                    fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   452
                            "The -scale option must be in range from 1 to 50, default is 5.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   453
                    quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   454
                }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   455
                argv += 2;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   456
                argc -= 2;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   457
            } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   458
                fprintf(stderr,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   459
                        "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   460
                quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   461
            }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   462
        } else if ((strcmp(argv[1], "-help") == 0)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   463
                   || (strcmp(argv[1], "-h") == 0)) {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   464
            PrintUsage(argv[0]);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   465
            quit(0);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   466
        } else {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   467
            fprintf(stderr, "Unrecognized option: %s.\n", argv[1]);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   468
            quit(10);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   469
        }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   470
        break;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   471
    }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   472
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   473
    RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   474
    if (RawMooseData == NULL) {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   475
        fprintf(stderr, "Can't allocate memory for movie !\n");
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   476
        free(RawMooseData);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   477
        quit(1);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   478
    }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   479
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   480
    /* load the trojan moose images */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   481
    handle = SDL_RWFromFile("moose.dat", "rb");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   482
    if (handle == NULL) {
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   483
        fprintf(stderr, "Can't find the file moose.dat !\n");
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   484
        free(RawMooseData);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   485
        quit(2);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   486
    }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   487
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   488
    SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   489
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   490
    SDL_RWclose(handle);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   491
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   492
    /* Create the window and renderer */
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   493
    window_w = MOOSEPIC_W * scale;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   494
    window_h = MOOSEPIC_H * scale;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   495
    window = SDL_CreateWindow("Happy Moose",
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   496
                              SDL_WINDOWPOS_UNDEFINED,
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   497
                              SDL_WINDOWPOS_UNDEFINED,
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   498
                              window_w, window_h,
7478
0d02f6a323f5 Removed not needed SDL_WINDOW_SHOWN from test programs.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 6256
diff changeset
   499
                              SDL_WINDOW_RESIZABLE);
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   500
    if (!window) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   501
        fprintf(stderr, "Couldn't set create window: %s\n", SDL_GetError());
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   502
        free(RawMooseData);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   503
        quit(4);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   504
    }
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   505
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   506
    renderer = SDL_CreateRenderer(window, -1, 0);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   507
    if (!renderer) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   508
        fprintf(stderr, "Couldn't set create renderer: %s\n", SDL_GetError());
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   509
        free(RawMooseData);
1151
be9c9c8f6d53 Removed atexit() from most of the test programs; atexit(SDL_Quit) isn't safe
Ryan C. Gordon <icculus@icculus.org>
parents: 1030
diff changeset
   510
        quit(4);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   511
    }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   512
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   513
    MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
5252
ec30f9d4c2a8 Fixed error check
Sam Lantinga <slouken@libsdl.org>
parents: 5216
diff changeset
   514
    if (!MooseTexture) {
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   515
        fprintf(stderr, "Couldn't set create texture: %s\n", SDL_GetError());
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   516
        free(RawMooseData);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   517
        quit(5);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   518
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   519
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   520
    for (i = 0; i < MOOSEFRAMES_COUNT; i++) {
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   521
        Uint8 MooseFrameRGB[MOOSEFRAME_SIZE*3];
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   522
        Uint8 *rgb;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   523
        Uint8 *frame;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   524
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   525
        rgb = MooseFrameRGB;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   526
        frame = RawMooseData + i * MOOSEFRAME_SIZE;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   527
        for (j = 0; j < MOOSEFRAME_SIZE; ++j) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   528
            rgb[0] = MooseColors[frame[j]].r;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   529
            rgb[1] = MooseColors[frame[j]].g;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   530
            rgb[2] = MooseColors[frame[j]].b;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   531
            rgb += 3;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   532
        }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   533
        ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   534
    }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   535
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   536
    free(RawMooseData);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   537
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   538
    /* set the start frame */
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   539
    i = 0;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   540
    if (nodelay) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   541
        fpsdelay = 0;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   542
    } else {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   543
        fpsdelay = 1000 / fps;
886
05c551e5bc64 Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents: 753
diff changeset
   544
    }
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   545
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   546
    displayrect.x = 0;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   547
    displayrect.y = 0;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   548
    displayrect.w = window_w;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   549
    displayrect.h = window_h;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   550
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   551
    /* Ignore key up events, they don't even get filtered */
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   552
    SDL_EventState(SDL_KEYUP, SDL_IGNORE);
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   553
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   554
    /* Loop, waiting for QUIT or RESIZE */
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   555
    while (!done) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   556
        while (SDL_PollEvent(&event)) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   557
            switch (event.type) {
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   558
            case SDL_WINDOWEVENT:
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   559
                if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
5357
ea8fec220775 Reset the viewport since we're stretching to the entire window.
Sam Lantinga <slouken@libsdl.org>
parents: 5274
diff changeset
   560
                    SDL_RenderSetViewport(renderer, NULL);
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   561
                    displayrect.w = window_w = event.window.data1;
5274
07559b6cb64f changeset: 5278:b4b71ec2af73
Sam Lantinga <slouken@libsdl.org>
parents: 5264
diff changeset
   562
                    displayrect.h = window_h = event.window.data2;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   563
                }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   564
                break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   565
            case SDL_MOUSEBUTTONDOWN:
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   566
                displayrect.x = event.button.x - window_w / 2;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   567
                displayrect.y = event.button.y - window_h / 2;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   568
                break;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   569
            case SDL_MOUSEMOTION:
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   570
                if (event.motion.state) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   571
                    displayrect.x = event.motion.x - window_w / 2;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   572
                    displayrect.y = event.motion.y - window_h / 2;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   573
                }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   574
                break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   575
            case SDL_KEYDOWN:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   576
                if (event.key.keysym.sym == SDLK_SPACE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   577
                    paused = !paused;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   578
                    break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   579
                }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   580
                if (event.key.keysym.sym != SDLK_ESCAPE) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   581
                    break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   582
                }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1642
diff changeset
   583
            case SDL_QUIT:
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   584
                done = SDL_TRUE;
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   585
                break;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   586
            }
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   587
        }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   588
        SDL_Delay(fpsdelay);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   589
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   590
        if (!paused) {
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   591
            i = (i + 1) % MOOSEFRAMES_COUNT;
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   592
5264
7ace5f8f432f Initial pass at shader YV12 support - doesn't quite work yet.
Sam Lantinga <slouken@libsdl.org>
parents: 5252
diff changeset
   593
            SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format));
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   594
        }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   595
        SDL_RenderClear(renderer);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   596
        SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   597
        SDL_RenderPresent(renderer);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   598
    }
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   599
    SDL_DestroyRenderer(renderer);
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   600
    quit(0);
672
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   601
    return 0;
5955fa16d4b8 Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   602
}
6256
1d905b13b102 Removed the SDL 1.2 compatibility API... we'll see how painful this is.
Sam Lantinga <slouken@libsdl.org>
parents: 5535
diff changeset
   603
#endif
5216
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   604
16d5e8e90e01 Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents: 4884
diff changeset
   605
/* vi: set ts=4 sw=4 expandtab: */