Mercurial > sdl-ios-xcode
annotate test/testoverlay2.c @ 5226:2ee8112bfc6b
Added a simple log message API
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 07 Feb 2011 16:45:40 -0800 |
parents | 16d5e8e90e01 |
children | ec30f9d4c2a8 |
rev | line source |
---|---|
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /******************************************************************************** |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 * * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 * 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
|
4 * 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
|
5 * * |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 ********************************************************************************/ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 |
1030
6b8f0543337c
Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
8 #include <stdlib.h> |
6b8f0543337c
Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
9 #include <stdio.h> |
6b8f0543337c
Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
10 #include <string.h> |
6b8f0543337c
Date: Sat, 15 Jan 2005 15:06:01 -0600
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
11 |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 #include "SDL.h" |
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 #define MOOSEPIC_W 64 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 #define MOOSEPIC_H 88 |
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 #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
|
18 #define MOOSEFRAMES_COUNT 10 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 |
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
|
20 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
|
21 {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
|
22 , {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
|
23 , {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
|
24 , {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
|
25 , |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
26 {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
|
27 , {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
|
28 , {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
|
29 , {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
|
30 , |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
31 {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
|
32 , {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
|
33 , {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
|
34 , {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
|
35 , |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
36 {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
|
37 , {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
|
38 , {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
|
39 , {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
|
40 , |
c121d94672cb
SDL 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 {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
|
42 , {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
|
43 , {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
|
44 , {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
|
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 {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
|
47 , {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
|
48 , {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
|
49 , {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
|
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 {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
|
52 , {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
|
53 , {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
|
54 , {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
|
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 {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
|
57 , {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
|
58 , {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
|
59 , {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
|
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 {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
|
62 , {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
|
63 , {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
|
64 , {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
|
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 {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
|
67 , {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
|
68 , {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
|
69 , {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
|
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 {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
|
72 , {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
|
73 , {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
|
74 , {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
|
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 {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
|
77 , {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
|
78 , {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
|
79 , {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
|
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 {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
|
82 , {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
|
83 , {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
|
84 , {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
|
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 {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
|
87 , {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
|
88 , {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
|
89 , {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
|
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 {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
|
92 , {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
|
93 , {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
|
94 , {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
|
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 {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
|
97 , {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
|
98 , {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
|
99 , {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
|
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 {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
|
102 , {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
|
103 , {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
|
104 , {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
|
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 {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
|
107 , {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
|
108 , {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
|
109 , {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
|
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 {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
|
112 , {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
|
113 , {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
|
114 , {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
|
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 {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
|
117 , {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
|
118 , {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
|
119 , {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
|
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 {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
|
122 , {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
|
123 , {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
|
124 , {239, 206, 173} |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 }; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 |
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
|
127 |
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
|
128 /* 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
|
129 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
|
130 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
|
131 { |
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
|
132 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
|
133 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
|
134 } |
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
|
135 |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 /* 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
|
137 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 /* 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
|
139 only as examples. |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 */ |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 |
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
|
142 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
|
143 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
|
144 { |
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
|
145 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
|
146 #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
|
147 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
|
148 yuv[1] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 yuv[2] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 #else |
4884
27ab20a36eba
- added directx include path to VS2008 solution
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
2267
diff
changeset
|
151 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
|
152 yuv[1] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 yuv[2] = 128; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 #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
|
155 } 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
|
156 #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
|
157 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
|
158 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
|
159 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
|
160 #else |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 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
|
162 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
|
163 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
|
164 #endif |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 |
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
|
167 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
|
168 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
|
169 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
|
170 yuv[0] = 255; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 |
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
|
174 void |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
175 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
|
176 int monochrome, int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 { |
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
|
178 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
|
179 int yuv[3]; |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
180 Uint8 *op[3]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
182 op[0] = out; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 *(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
|
189 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
|
190 *(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
|
191 *(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
|
192 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
193 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
|
194 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
195 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 } |
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 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
|
199 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
|
200 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 { |
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
|
202 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
|
203 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
|
204 Uint8 *p, *op[3]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 |
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
|
206 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
|
207 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 |
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
|
209 /* 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 *(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
|
218 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
|
219 *(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
|
220 *(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
|
221 } |
c121d94672cb
SDL 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 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
|
223 } |
c121d94672cb
SDL 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 } |
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_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
|
227 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
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
|
230 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
|
231 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
|
232 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 { |
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
|
234 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
|
235 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
|
236 Uint8 *p, *op; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
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
|
238 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
|
239 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 |
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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 *(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
|
248 *(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
|
249 *(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
|
250 } 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
|
251 *(op++) = yuv[0]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 |
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
|
253 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
|
254 } |
c121d94672cb
SDL 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 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 |
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
|
257 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
|
258 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 } |
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 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
|
262 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
|
263 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 { |
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
|
265 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
|
266 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
|
267 Uint8 *p, *op; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 |
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
|
269 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
|
270 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 |
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
|
272 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
|
273 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
|
274 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
|
275 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
|
276 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
|
277 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
|
278 *(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
|
279 *(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
|
280 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
|
281 } 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
|
282 *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
|
283 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
|
284 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 |
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
|
286 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
|
287 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
288 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 |
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
|
290 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
|
291 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
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
|
294 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
|
295 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
|
296 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 { |
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
|
298 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
|
299 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
|
300 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
|
301 |
c121d94672cb
SDL 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 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
|
303 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 |
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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 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
|
311 *(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
|
312 *(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
|
313 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
|
314 } 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
|
315 *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
|
316 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
|
317 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 |
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
|
319 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
|
320 } |
c121d94672cb
SDL 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 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 |
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
|
323 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
|
324 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 |
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
|
327 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
|
328 PrintUsage(char *argv0) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 { |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 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
|
331 fprintf(stderr, "\n"); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
332 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
|
333 fprintf(stderr, "\n"); |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
334 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
|
335 fprintf(stderr, " -nodelay\n"); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
336 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
|
337 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
|
338 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
|
339 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
|
340 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
|
341 "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
|
342 fprintf(stderr, "\n"); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 |
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
|
345 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
|
346 main(int argc, char **argv) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 { |
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
|
348 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
|
349 SDL_RWops *handle; |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
350 int window_w; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
351 int window_h; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
352 SDL_Window *window; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
353 SDL_Renderer *renderer; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
354 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
|
355 SDL_Texture *MooseTexture; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
356 SDL_Rect displayrect; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 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
|
358 int paused = 0; |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
359 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
|
360 int fps = 12; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 int fpsdelay; |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
362 int nodelay = 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
|
363 int overlay_format = SDL_YUY2_OVERLAY; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
364 int scale = 5; |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
365 SDL_bool done = SDL_FALSE; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 |
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
|
367 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
|
368 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
|
369 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
|
370 } |
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
|
371 |
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
|
372 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
|
373 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
|
374 if (argv[2]) { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 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
|
376 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
|
377 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
|
378 "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
|
379 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 } |
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
|
381 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
|
382 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
|
383 "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
|
384 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 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
|
388 } 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
|
389 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
|
390 "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
|
391 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
393 } 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
|
394 nodelay = 1; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
395 argv += 1; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
396 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
|
397 } 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
|
398 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
|
399 if (!strcmp(argv[2], "YV12")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 overlay_format = SDL_YV12_OVERLAY; |
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 else if (!strcmp(argv[2], "IYUV")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 overlay_format = SDL_IYUV_OVERLAY; |
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
|
403 else if (!strcmp(argv[2], "YUY2")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 overlay_format = SDL_YUY2_OVERLAY; |
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
|
405 else if (!strcmp(argv[2], "UYVY")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 overlay_format = SDL_UYVY_OVERLAY; |
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
|
407 else if (!strcmp(argv[2], "YVYU")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 overlay_format = SDL_YVYU_OVERLAY; |
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
|
409 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
|
410 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
|
411 "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
|
412 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
|
413 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 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
|
417 } 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
|
418 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
|
419 "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
|
420 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 } |
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
|
422 } 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
|
423 if (argv[2]) { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 "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
|
428 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 } |
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
|
430 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
|
431 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
|
432 "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
|
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 -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
|
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], "-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
|
443 || (strcmp(argv[1], "-h") == 0)) { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 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
|
445 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
|
446 } else { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 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
|
448 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 } |
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
|
452 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
453 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
|
454 if (RawMooseData == NULL) { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 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
|
456 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
|
457 quit(1); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 /* 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
|
461 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
|
462 if (handle == NULL) { |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 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
|
464 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
|
465 quit(2); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 } |
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
|
467 |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 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
|
469 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
470 SDL_RWclose(handle); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
471 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
472 /* Create the window and renderer */ |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
473 window_w = MOOSEPIC_W * scale; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
474 window_h = MOOSEPIC_H * scale; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
475 window = SDL_CreateWindow("Happy Moose", |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
476 SDL_WINDOWPOS_UNDEFINED, |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
477 SDL_WINDOWPOS_UNDEFINED, |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
478 window_w, window_h, |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
479 SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
480 if (!window) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
481 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
|
482 free(RawMooseData); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
483 quit(4); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
484 } |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
485 |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
486 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
|
487 if (!renderer) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
488 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
|
489 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
|
490 quit(4); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
493 MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
494 if (!renderer) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
495 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
|
496 free(RawMooseData); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
497 quit(5); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
498 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 |
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
|
500 for (i = 0; i < MOOSEFRAMES_COUNT; i++) { |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
501 Uint8 MooseFrameRGB[MOOSEFRAME_SIZE*3]; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
502 Uint8 *rgb; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
503 Uint8 *frame; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
504 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
505 rgb = MooseFrameRGB; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
506 frame = RawMooseData + i * MOOSEFRAME_SIZE; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
507 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
|
508 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
|
509 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
|
510 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
|
511 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
|
512 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
513 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
|
514 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 free(RawMooseData); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
518 /* set the start frame */ |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
519 i = 0; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
520 if (nodelay) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
521 fpsdelay = 0; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
522 } else { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
523 fpsdelay = 1000 / fps; |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
524 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
526 displayrect.x = 0; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
527 displayrect.y = 0; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
528 displayrect.w = window_w; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
529 displayrect.h = window_h; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
530 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 /* 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
|
532 SDL_EventState(SDL_KEYUP, SDL_IGNORE); |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 /* Loop, waiting for QUIT or RESIZE */ |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
535 while (!done) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
536 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
|
537 switch (event.type) { |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
538 case SDL_WINDOWEVENT: |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
539 if (event.window.event == SDL_WINDOWEVENT_RESIZED) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
540 displayrect.w = window_w = event.window.data1; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
541 displayrect.w = 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
|
542 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
543 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
|
544 case SDL_MOUSEBUTTONDOWN: |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
545 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
|
546 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
|
547 break; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
548 case SDL_MOUSEMOTION: |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
549 if (event.motion.state) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
550 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
|
551 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
|
552 } |
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
|
553 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
|
554 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
|
555 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
|
556 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
|
557 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
|
558 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
559 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
|
560 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
|
561 } |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
562 case SDL_QUIT: |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
563 done = SDL_TRUE; |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
564 break; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
565 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
567 SDL_Delay(fpsdelay); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
569 if (!paused) { |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
570 i = (i + 1) % MOOSEFRAMES_COUNT; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
571 |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
572 SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*2); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
573 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
574 SDL_RenderClear(renderer); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
575 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
|
576 SDL_RenderPresent(renderer); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
577 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
578 SDL_DestroyRenderer(renderer); |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
579 quit(0); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 return 0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
581 } |
5221
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
582 |
16d5e8e90e01
Updated testoverlay2 to use the SDL 2D rendering API
Sam Lantinga <slouken@libsdl.org>
parents:
4884
diff
changeset
|
583 /* vi: set ts=4 sw=4 expandtab: */ |