Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
60b401ae
Commit
60b401ae
authored
Jul 19, 2010
by
Eli Gottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added code to make testshape switch shapes on keystrokes and exit on an ESC keystroke.
parent
70ad6fd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
testshape.c
test/testshape.c
+9
-5
No files found.
test/testshape.c
View file @
60b401ae
...
...
@@ -5,6 +5,7 @@
#include <SDL_pixels.h>
#include <SDL_video.h>
#include <SDL_shape.h>
#include <SDL_keysym.h>
#define SHAPED_WINDOW_X 150
#define SHAPED_WINDOW_Y 150
...
...
@@ -86,7 +87,7 @@ int main(int argc,char** argv) {
event_pending
=
SDL_PollEvent
(
&
event
);
unsigned
int
current_picture
=
0
;
SDL_WindowShapeMode
mode
=
{
ShapeModeDefault
,
1
};
int
mouse
_down
=
0
;
int
button
_down
=
0
;
Uint32
format
=
0
,
access
=
0
;
SDL_Rect
texture_dimensions
=
{
0
,
0
,
0
,
0
};
SDL_QueryTexture
(
textures
[
current_picture
],
&
format
,
&
access
,
&
texture_dimensions
.
w
,
&
texture_dimensions
.
h
);
...
...
@@ -95,10 +96,13 @@ int main(int argc,char** argv) {
while
(
should_exit
==
0
)
{
event_pending
=
SDL_PollEvent
(
&
event
);
if
(
event_pending
==
1
)
{
if
(
event
.
type
==
SDL_MOUSEBUTTONDOWN
)
mouse_down
=
1
;
if
(
mouse_down
&&
event
.
type
==
SDL_MOUSEBUTTONUP
)
{
mouse_down
=
0
;
if
(
event
.
type
==
SDL_KEYDOWN
)
{
button_down
=
1
;
if
(
event
.
key
.
keysym
.
sym
==
SDLK_ESCAPE
)
should_exit
=
1
;
}
if
(
button_down
&&
event
.
type
==
SDL_KEYUP
)
{
button_down
=
0
;
current_picture
+=
1
;
if
(
current_picture
>=
num_pictures
)
current_picture
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment