Mercurial > sdl-ios-xcode
annotate test/testoverlay2.c @ 1674:7688a73b25b1 SDL-1.3
Finishing up keyboard code revamp, at least for now...
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 11 Jun 2006 05:27:10 +0000 |
parents | 4da1ee79c9af |
children |
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 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
20 SDL_Color MooseColors[84] = { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
21 {49, 49, 49} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
22 , {66, 24, 0} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
23 , {66, 33, 0} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
24 , {66, 66, 66} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
25 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
26 {66, 115, 49} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
27 , {74, 33, 0} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
28 , {74, 41, 16} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
29 , {82, 33, 8} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
30 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
31 {82, 41, 8} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
32 , {82, 49, 16} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
33 , {82, 82, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
34 , {90, 41, 8} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
35 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
36 {90, 41, 16} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
37 , {90, 57, 24} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
38 , {99, 49, 16} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
39 , {99, 66, 24} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
40 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
41 {99, 66, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
42 , {99, 74, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
43 , {107, 57, 24} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
44 , {107, 82, 41} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
45 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
46 {115, 57, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
47 , {115, 66, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
48 , {115, 66, 41} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
49 , {115, 74, 0} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
50 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
51 {115, 90, 49} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
52 , {115, 115, 115} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
53 , {123, 82, 0} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
54 , {123, 99, 57} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
55 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
56 {132, 66, 41} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
57 , {132, 74, 41} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
58 , {132, 90, 8} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
59 , {132, 99, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
60 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
61 {132, 99, 66} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
62 , {132, 107, 66} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
63 , {140, 74, 49} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
64 , {140, 99, 16} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
65 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
66 {140, 107, 74} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
67 , {140, 115, 74} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
68 , {148, 107, 24} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
69 , {148, 115, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
70 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
71 {148, 123, 74} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
72 , {148, 123, 90} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
73 , {156, 115, 33} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
74 , {156, 115, 90} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
75 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
76 {156, 123, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
77 , {156, 132, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
78 , {156, 132, 99} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
79 , {156, 156, 156} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
80 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
81 {165, 123, 49} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
82 , {165, 123, 90} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
83 , {165, 132, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
84 , {165, 132, 90} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
85 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
86 {165, 132, 99} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
87 , {165, 140, 90} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
88 , {173, 132, 57} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
89 , {173, 132, 99} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
90 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
91 {173, 140, 107} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
92 , {173, 140, 115} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
93 , {173, 148, 99} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
94 , {173, 173, 173} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
95 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
96 {181, 140, 74} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
97 , {181, 148, 115} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
98 , {181, 148, 123} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
99 , {181, 156, 107} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
100 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
101 {189, 148, 123} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
102 , {189, 156, 82} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
103 , {189, 156, 123} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
104 , {189, 156, 132} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
105 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
106 {189, 189, 189} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
107 , {198, 156, 123} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
108 , {198, 165, 132} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
109 , {206, 165, 99} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
110 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
111 {206, 165, 132} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
112 , {206, 173, 140} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
113 , {206, 206, 206} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
114 , {214, 173, 115} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
115 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
116 {214, 173, 140} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
117 , {222, 181, 148} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
118 , {222, 189, 132} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
119 , {222, 189, 156} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
120 , |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
121 {222, 222, 222} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
122 , {231, 198, 165} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
123 , {231, 231, 231} |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
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. */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
129 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
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 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
132 SDL_Quit(); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
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 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
142 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
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 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
145 if (monochrome) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
146 #if 1 /* these are the two formulas that I found on the FourCC site... */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
147 yuv[0] = 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 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 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
|
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 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
155 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
156 #if 1 /* these are the two formulas that I found on the FourCC site... */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
157 yuv[0] = 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
158 yuv[1] = (rgb[2] - yuv[0]) * 0.565 + 128; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
159 yuv[2] = (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 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
167 if (luminance != 100) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
168 yuv[0] = yuv[0] * luminance / 100; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
169 if (yuv[0] > 255) |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
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 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
174 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
175 ConvertRGBtoYV12(SDL_Surface * s, SDL_Overlay * o, int monochrome, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
176 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
178 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
179 int yuv[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
180 Uint8 *p, *op[3]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
182 SDL_LockSurface(s); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
183 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
185 /* Convert */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
186 for (y = 0; y < s->h && y < o->h; y++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
187 p = ((Uint8 *) s->pixels) + s->pitch * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
188 op[0] = o->pixels[0] + o->pitches[0] * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
189 op[1] = o->pixels[1] + o->pitches[1] * (y / 2); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
190 op[2] = o->pixels[2] + o->pitches[2] * (y / 2); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
191 for (x = 0; x < s->w && x < o->w; x++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
192 RGBtoYUV(p, yuv, monochrome, luminance); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
193 *(op[0]++) = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
194 if (x % 2 == 0 && y % 2 == 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
195 *(op[1]++) = yuv[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
196 *(op[2]++) = yuv[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
197 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
198 p += s->format->BytesPerPixel; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
199 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
200 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
202 SDL_UnlockYUVOverlay(o); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
203 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
206 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
207 ConvertRGBtoIYUV(SDL_Surface * s, SDL_Overlay * o, int monochrome, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
208 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
210 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
211 int yuv[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
212 Uint8 *p, *op[3]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
214 SDL_LockSurface(s); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
215 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
217 /* Convert */ |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
218 for (y = 0; y < s->h && y < o->h; y++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
219 p = ((Uint8 *) s->pixels) + s->pitch * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
220 op[0] = o->pixels[0] + o->pitches[0] * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
221 op[1] = o->pixels[1] + o->pitches[1] * (y / 2); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
222 op[2] = o->pixels[2] + o->pitches[2] * (y / 2); |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
223 for (x = 0; x < s->w && x < o->w; x++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
224 RGBtoYUV(p, yuv, monochrome, luminance); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
225 *(op[0]++) = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
226 if (x % 2 == 0 && y % 2 == 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
227 *(op[1]++) = yuv[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
228 *(op[2]++) = yuv[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
229 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
230 p += s->format->BytesPerPixel; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
231 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
232 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
234 SDL_UnlockYUVOverlay(o); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
235 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
238 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
239 ConvertRGBtoUYVY(SDL_Surface * s, SDL_Overlay * o, int monochrome, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
240 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
242 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
243 int yuv[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
244 Uint8 *p, *op; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
246 SDL_LockSurface(s); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
247 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
249 for (y = 0; y < s->h && y < o->h; y++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
250 p = ((Uint8 *) s->pixels) + s->pitch * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
251 op = o->pixels[0] + o->pitches[0] * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
252 for (x = 0; x < s->w && x < o->w; x++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
253 RGBtoYUV(p, yuv, monochrome, luminance); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
254 if (x % 2 == 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
255 *(op++) = yuv[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
256 *(op++) = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
257 *(op++) = yuv[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
258 } else |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
259 *(op++) = yuv[0]; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
261 p += s->format->BytesPerPixel; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
262 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
263 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
265 SDL_UnlockYUVOverlay(o); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
266 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
269 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
270 ConvertRGBtoYVYU(SDL_Surface * s, SDL_Overlay * o, int monochrome, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
271 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
273 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
274 int yuv[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
275 Uint8 *p, *op; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
277 SDL_LockSurface(s); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
278 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
280 for (y = 0; y < s->h && y < o->h; y++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
281 p = ((Uint8 *) s->pixels) + s->pitch * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
282 op = o->pixels[0] + o->pitches[0] * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
283 for (x = 0; x < s->w && x < o->w; x++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
284 RGBtoYUV(p, yuv, monochrome, luminance); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
285 if (x % 2 == 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
286 *(op++) = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
287 *(op++) = yuv[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
288 op[1] = yuv[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
289 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
290 *op = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
291 op += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
292 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
294 p += s->format->BytesPerPixel; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
295 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
296 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
298 SDL_UnlockYUVOverlay(o); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
299 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
302 void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
303 ConvertRGBtoYUY2(SDL_Surface * s, SDL_Overlay * o, int monochrome, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
304 int luminance) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
306 int x, y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
307 int yuv[3]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
308 Uint8 *p, *op; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
309 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
310 SDL_LockSurface(s); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
311 SDL_LockYUVOverlay(o); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
313 for (y = 0; y < s->h && y < o->h; y++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
314 p = ((Uint8 *) s->pixels) + s->pitch * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
315 op = o->pixels[0] + o->pitches[0] * y; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
316 for (x = 0; x < s->w && x < o->w; x++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
317 RGBtoYUV(p, yuv, monochrome, luminance); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
318 if (x % 2 == 0) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
319 *(op++) = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
320 *(op++) = yuv[1]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
321 op[1] = yuv[2]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
322 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
323 *op = yuv[0]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
324 op += 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
325 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
327 p += s->format->BytesPerPixel; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
328 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
329 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
331 SDL_UnlockYUVOverlay(o); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
332 SDL_UnlockSurface(s); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
335 static void |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
336 PrintUsage(char *argv0) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
338 fprintf(stderr, "Usage: %s [arg] [arg] [arg] ...\n", argv0); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
339 fprintf(stderr, "\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
340 fprintf(stderr, "Where 'arg' is any of the following options:\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
341 fprintf(stderr, "\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
342 fprintf(stderr, " -fps <frames per second>\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
343 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
344 " -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
345 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
346 " -scale <scale factor> (initial scale of the overlay)\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
347 fprintf(stderr, " -help (shows this help)\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
348 fprintf(stderr, "\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
349 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
350 "Press ESC to exit, or SPACE to freeze the movie while application running.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
351 fprintf(stderr, "\n"); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
354 int |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
355 main(int argc, char **argv) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
357 Uint8 *RawMooseData; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
358 SDL_RWops *handle; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
359 SDL_Surface *screen; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
360 SDL_Surface *MooseFrame[MOOSEFRAMES_COUNT]; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
361 SDL_Overlay *overlay; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 SDL_Rect overlayrect; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 SDL_Event event; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 Uint32 lastftick; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
365 int paused = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
366 int resized = 0; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 int i; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
368 int fps = 12; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 int fpsdelay; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
370 int overlay_format = SDL_YUY2_OVERLAY; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
371 int scale = 5; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
373 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
374 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); |
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
|
375 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
|
376 } |
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
|
377 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
378 while (argc > 1) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
379 if (strcmp(argv[1], "-fps") == 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
380 if (argv[2]) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
381 fps = atoi(argv[2]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
382 if (fps == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
383 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
384 "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
385 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
387 if ((fps < 0) || (fps > 1000)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
388 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
389 "The -fps option must be in range from 1 to 1000, default is 12.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
390 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 argc -= 2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
394 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
395 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
396 "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
397 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
399 } else if (strcmp(argv[1], "-format") == 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
400 if (argv[2]) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
401 if (!strcmp(argv[2], "YV12")) |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 overlay_format = SDL_YV12_OVERLAY; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
403 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
|
404 overlay_format = SDL_IYUV_OVERLAY; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
405 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
|
406 overlay_format = SDL_YUY2_OVERLAY; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
407 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
|
408 overlay_format = SDL_UYVY_OVERLAY; |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
409 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
|
410 overlay_format = SDL_YVYU_OVERLAY; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
411 else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
412 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
413 "The -format option %s is not recognized, see help for info.\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
414 argv[2]); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
415 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 argc -= 2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
419 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
420 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
421 "The -format option requires an argument, default is YUY2.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
422 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
424 } else if (strcmp(argv[1], "-scale") == 0) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
425 if (argv[2]) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
426 scale = atoi(argv[2]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
427 if (scale == 0) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
428 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
429 "The -scale option requires an argument [from 1 to 50], default is 5.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
430 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
432 if ((scale < 0) || (scale > 50)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
433 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
434 "The -scale option must be in range from 1 to 50, default is 5.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
435 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 argv += 2; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 argc -= 2; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
439 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
440 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
441 "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
442 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
444 } else if ((strcmp(argv[1], "-help") == 0) |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
445 || (strcmp(argv[1], "-h") == 0)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
446 PrintUsage(argv[0]); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
447 quit(0); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
448 } else { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
449 fprintf(stderr, "Unrecognized option: %s.\n", argv[1]); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
450 quit(10); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 break; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
454 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
455 RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
456 if (RawMooseData == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
457 fprintf(stderr, "Can't allocate memory for movie !\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
458 free(RawMooseData); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
459 quit(1); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 /* load the trojan moose images */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
463 handle = SDL_RWFromFile("moose.dat", "rb"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
464 if (handle == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
465 fprintf(stderr, "Can't find the file moose.dat !\n"); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
466 free(RawMooseData); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
467 quit(2); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
468 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
470 SDL_RWread(handle, RawMooseData, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
471 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
472 SDL_RWclose(handle); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 |
673
63419da96d13
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
672
diff
changeset
|
474 /* Set video mode */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
475 if ((screen = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
476 SDL_SetVideoMode(MOOSEPIC_W * scale, MOOSEPIC_H * scale, 0, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
477 SDL_RESIZABLE | SDL_SWSURFACE)) == NULL) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
478 fprintf(stderr, "Couldn't set video mode: %s\n", SDL_GetError()); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
479 free(RawMooseData); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
480 quit(4); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 /* Set the window manager title bar */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
484 SDL_WM_SetCaption("SDL test overlay: running moose", "testoverlay2"); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
486 for (i = 0; i < MOOSEFRAMES_COUNT; i++) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
487 MooseFrame[i] = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
488 SDL_CreateRGBSurfaceFrom(RawMooseData + i * MOOSEFRAME_SIZE, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
489 MOOSEPIC_W, MOOSEPIC_H, 8, MOOSEPIC_W, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
490 0, 0, 0, 0); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
491 if (MooseFrame[i] == NULL) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
492 fprintf(stderr, "Couldn't create SDL_Surfaces:%s\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
493 SDL_GetError()); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
494 free(RawMooseData); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
495 quit(5); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
497 SDL_SetColors(MooseFrame[i], MooseColors, 0, 84); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
499 { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
500 SDL_Surface *newsurf; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
501 SDL_PixelFormat format; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
503 format.palette = NULL; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
504 format.BitsPerPixel = 32; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
505 format.BytesPerPixel = 4; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 #if SDL_BYTEORDER == SDL_LIL_ENDIAN |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
507 format.Rshift = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
508 format.Gshift = 8; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
509 format.Bshift = 16; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 #else |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
511 format.Rshift = 24; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
512 format.Gshift = 16; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
513 format.Bshift = 8; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 #endif |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
515 format.Ashift = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
516 format.Rmask = 0xff << format.Rshift; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
517 format.Gmask = 0xff << format.Gshift; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
518 format.Bmask = 0xff << format.Bshift; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
519 format.Amask = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
520 format.Rloss = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
521 format.Gloss = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
522 format.Bloss = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
523 format.Aloss = 8; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
524 format.colorkey = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
525 format.alpha = 0; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
527 newsurf = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
528 SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
529 if (!newsurf) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
530 fprintf(stderr, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
531 "Couldn't convert picture to 32bits RGB: %s\n", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
532 SDL_GetError()); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
533 quit(6); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
534 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
535 SDL_FreeSurface(MooseFrame[i]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
536 MooseFrame[i] = newsurf; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
537 } |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
753
diff
changeset
|
538 } |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
540 free(RawMooseData); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
542 overlay = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
543 SDL_CreateYUVOverlay(MOOSEPIC_W, MOOSEPIC_H, overlay_format, screen); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
544 if (!overlay) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
545 fprintf(stderr, "Couldn't create overlay: %s\n", SDL_GetError()); |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
546 quit(7); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
549 printf("Created %dx%dx%d %s %s overlay\n", overlay->w, overlay->h, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
550 overlay->planes, overlay->hw_overlay ? "hardware" : "software", |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
551 overlay->format == SDL_YV12_OVERLAY ? "YV12" : overlay->format == |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
552 SDL_IYUV_OVERLAY ? "IYUV" : overlay->format == |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
553 SDL_YUY2_OVERLAY ? "YUY2" : overlay->format == |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
554 SDL_UYVY_OVERLAY ? "UYVY" : overlay->format == |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
555 SDL_YVYU_OVERLAY ? "YVYU" : "Unknown"); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
556 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
557 for (i = 0; i < overlay->planes; i++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
558 printf(" plane %d: pitch=%d\n", i, overlay->pitches[i]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
559 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
560 |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
561 overlayrect.x = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
562 overlayrect.y = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
563 overlayrect.w = MOOSEPIC_W * scale; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
564 overlayrect.h = MOOSEPIC_H * scale; |
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 /* set the start frame */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
567 i = 0; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
568 fpsdelay = 1000 / fps; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
569 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
570 /* Ignore key up events, they don't even get filtered */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
571 SDL_EventState(SDL_KEYUP, SDL_IGNORE); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
572 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
573 lastftick = SDL_GetTicks(); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
574 |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
575 /* Loop, waiting for QUIT or RESIZE */ |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
576 while (1) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
577 if (SDL_PollEvent(&event)) { |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
578 switch (event.type) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
579 case SDL_VIDEORESIZE: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
580 screen = |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
581 SDL_SetVideoMode(event.resize.w, event.resize.h, 0, |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
582 SDL_RESIZABLE | SDL_SWSURFACE); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
583 overlayrect.w = event.resize.w; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
584 overlayrect.h = event.resize.h; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
585 if (paused) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
586 resized = 1; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
587 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
588 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
589 case SDL_MOUSEBUTTONDOWN: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
590 overlayrect.x = event.button.x - overlayrect.w / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
591 overlayrect.y = event.button.y - overlayrect.h / 2; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
592 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
593 case SDL_KEYDOWN: |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
594 if (event.key.keysym.sym == SDLK_SPACE) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
595 paused = !paused; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
596 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
597 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
598 if (event.key.keysym.sym != SDLK_ESCAPE) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
599 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
600 } |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
601 case SDL_QUIT: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
602 SDL_FreeYUVOverlay(overlay); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
603 for (i = 0; i < MOOSEFRAMES_COUNT; i++) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
604 SDL_FreeSurface(MooseFrame[i]); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
605 } |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
606 quit(0); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
610 if ((!paused) || (resized)) { |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
611 if (((SDL_GetTicks() - lastftick) > fpsdelay) || (resized)) { |
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
612 lastftick = SDL_GetTicks(); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
613 |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
614 switch (overlay_format) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
615 case SDL_YUY2_OVERLAY: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
616 ConvertRGBtoYUY2(MooseFrame[i], overlay, 0, 100); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
617 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
618 case SDL_YV12_OVERLAY: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
619 ConvertRGBtoYV12(MooseFrame[i], overlay, 0, 100); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
620 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
621 case SDL_UYVY_OVERLAY: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
622 ConvertRGBtoUYVY(MooseFrame[i], overlay, 0, 100); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
623 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
624 case SDL_YVYU_OVERLAY: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
625 ConvertRGBtoYVYU(MooseFrame[i], overlay, 0, 100); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
626 break; |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
627 case SDL_IYUV_OVERLAY: |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
628 ConvertRGBtoIYUV(MooseFrame[i], overlay, 0, 100); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
629 break; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
630 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
632 SDL_DisplayYUVOverlay(overlay, &overlayrect); |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
633 if (!resized) { |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
634 i++; |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
635 if (i == 10) { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
636 i = 0; |
753
b14fdadd8311
Date: Thu, 4 Dec 2003 07:48:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
673
diff
changeset
|
637 } |
1662
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
638 } else { |
782fd950bd46
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents:
1642
diff
changeset
|
639 resized = 0; |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
640 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
643 /* kind of timeslice to OS */ |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
644 SDL_Delay(1); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 } |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
646 |
1668
4da1ee79c9af
more tweaking indent options
Sam Lantinga <slouken@libsdl.org>
parents:
1662
diff
changeset
|
647 SDL_Quit(); |
672
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 return 0; |
5955fa16d4b8
Date: Mon, 28 Jul 2003 18:30:50 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 } |