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
9ed73976
Commit
9ed73976
authored
Feb 20, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug 1137, updated the keyboard demo with latest rendering API changes.
parent
8e56849e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+12
-19
project.pbxproj
Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj
+2
-10
keyboard.c
Xcode-iPhoneOS/Demos/src/keyboard.c
+10
-9
No files found.
Xcode-iPhoneOS/Demos/DemosiPhoneOS.xcodeproj/project.pbxproj
View file @
9ed73976
...
...
@@ -975,11 +975,7 @@
GCC_PREFIX_HEADER
=
""
;
INFOPLIST_FILE
=
Info.plist
;
INSTALL_PATH
=
"$(HOME)/Applications"
;
LIBRARY_SEARCH_PATHS
=
(
"$(inherited)"
,
"\\\\\\\"$(SRCROOT)\\\\\\\""
,
"\"$(SRCROOT)/../SDL/build/Debug-iphoneos\""
,
);
LIBRARY_SEARCH_PATHS
=
"$(inherited)"
;
PREBINDING
=
NO
;
PRODUCT_NAME
=
Keyboard
;
SDKROOT
=
iphoneos
;
...
...
@@ -998,11 +994,7 @@
GCC_PREFIX_HEADER
=
""
;
INFOPLIST_FILE
=
Info.plist
;
INSTALL_PATH
=
"$(HOME)/Applications"
;
LIBRARY_SEARCH_PATHS
=
(
"$(inherited)"
,
"\\\\\\\"$(SRCROOT)\\\\\\\""
,
"\"$(SRCROOT)/../SDL/build/Debug-iphoneos\""
,
);
LIBRARY_SEARCH_PATHS
=
"$(inherited)"
;
PREBINDING
=
NO
;
PRODUCT_NAME
=
Fireworks
;
SDKROOT
=
iphoneos
;
...
...
Xcode-iPhoneOS/Demos/src/keyboard.c
View file @
9ed73976
...
...
@@ -23,6 +23,7 @@ extern DECLSPEC int SDLCALL SDL_iPhoneKeyboardToggle(SDL_Window * window);
void
cleanup
(
void
);
void
drawBlank
(
int
x
,
int
y
);
static
SDL_Renderer
*
renderer
;
static
int
numChars
=
0
;
/* number of characters we've typed so far */
static
SDL_bool
lastCharWasColon
=
0
;
/* we use this to detect sequences such as :) */
static
SDL_Color
bg_color
=
{
50
,
50
,
100
,
255
};
/* color of background */
...
...
@@ -157,7 +158,7 @@ drawIndex(int index)
{
GLYPH_SIZE_IMAGE
*
index
,
0
,
GLYPH_SIZE_IMAGE
,
GLYPH_SIZE_IMAGE
};
SDL_Rect
dstRect
=
{
x
,
y
,
GLYPH_SIZE_SCREEN
,
GLYPH_SIZE_SCREEN
};
drawBlank
(
x
,
y
);
SDL_RenderCopy
(
texture
,
&
srcRect
,
&
dstRect
);
SDL_RenderCopy
(
renderer
,
texture
,
&
srcRect
,
&
dstRect
);
}
/* draws the cursor icon at the current end position of the text */
...
...
@@ -174,9 +175,9 @@ void
drawBlank
(
int
x
,
int
y
)
{
SDL_Rect
rect
=
{
x
,
y
,
GLYPH_SIZE_SCREEN
,
GLYPH_SIZE_SCREEN
};
SDL_SetRenderDrawColor
(
bg_color
.
r
,
bg_color
.
g
,
bg_color
.
b
,
SDL_SetRenderDrawColor
(
renderer
,
bg_color
.
r
,
bg_color
.
g
,
bg_color
.
b
,
bg_color
.
unused
);
SDL_RenderFill
(
&
rect
);
SDL_RenderFill
Rect
(
renderer
,
&
rect
);
}
/* moves backwards one character, erasing the last one put down */
...
...
@@ -219,7 +220,7 @@ loadFont(void)
SDL_BlitSurface
(
surface
,
NULL
,
converted
,
NULL
);
/* create our texture */
texture
=
SDL_CreateTextureFromSurface
(
SDL_PIXELFORMAT_ABGR8888
,
converted
);
SDL_CreateTextureFromSurface
(
renderer
,
converted
);
if
(
texture
==
0
)
{
printf
(
"texture creation failed: %s
\n
"
,
SDL_GetError
());
}
else
{
...
...
@@ -248,16 +249,16 @@ main(int argc, char *argv[])
/* create window */
window
=
SDL_CreateWindow
(
"iPhone keyboard test"
,
0
,
0
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
,
0
);
/* create renderer */
SDL_CreateRenderer
(
window
,
0
,
0
);
renderer
=
SDL_CreateRenderer
(
window
,
-
1
,
0
);
/* load up our font */
loadFont
();
/* draw the background, we'll just paint over it */
SDL_SetRenderDrawColor
(
bg_color
.
r
,
bg_color
.
g
,
bg_color
.
b
,
SDL_SetRenderDrawColor
(
renderer
,
bg_color
.
r
,
bg_color
.
g
,
bg_color
.
b
,
bg_color
.
unused
);
SDL_RenderFill
(
NULL
);
SDL_RenderPresent
();
SDL_RenderFill
Rect
(
renderer
,
NULL
);
SDL_RenderPresent
(
renderer
);
int
done
=
0
;
/* loop till we get SDL_Quit */
...
...
@@ -293,7 +294,7 @@ main(int argc, char *argv[])
}
/* check if the key was a colon */
/* draw our updates to the screen */
SDL_RenderPresent
();
SDL_RenderPresent
(
renderer
);
break
;
#ifdef __IPHONEOS__
case
SDL_MOUSEBUTTONUP
:
...
...
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