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
25101525
Commit
25101525
authored
Jan 12, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fill in the video mode with the correct screen format
parent
a410db1a
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
104 deletions
+120
-104
SDLActivity.java
android-project/src/org/libsdl/app/SDLActivity.java
+102
-81
SDL_android.cpp
src/SDL_android.cpp
+4
-13
SDL_androidvideo.c
src/video/android/SDL_androidvideo.c
+10
-9
SDL_androidvideo.h
src/video/android/SDL_androidvideo.h
+4
-1
No files found.
android-project/src/org/libsdl/app/SDLActivity.java
View file @
25101525
This diff is collapsed.
Click to expand it.
src/SDL_android.cpp
View file @
25101525
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
extern
"C"
{
extern
"C"
{
#include "events/SDL_events_c.h"
#include "events/SDL_events_c.h"
#include "video/android/SDL_androidkeyboard.h"
#include "video/android/SDL_androidkeyboard.h"
#include "video/android/SDL_androidvideo.h"
}
}
/*******************************************************************************
/*******************************************************************************
...
@@ -49,9 +50,6 @@ jmethodID midFlipBuffers;
...
@@ -49,9 +50,6 @@ jmethodID midFlipBuffers;
jmethodID
midEnableFeature
;
jmethodID
midEnableFeature
;
jmethodID
midUpdateAudio
;
jmethodID
midUpdateAudio
;
extern
"C"
void
Android_SetScreenResolution
(
int
width
,
int
height
);
extern
"C"
int
SDL_SendQuit
();
//If we're not the active app, don't try to render
//If we're not the active app, don't try to render
bool
bRenderingEnabled
=
false
;
bool
bRenderingEnabled
=
false
;
...
@@ -145,21 +143,12 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit( JNIEnv* env,
...
@@ -145,21 +143,12 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeQuit( JNIEnv* env,
SDL_SendQuit
();
SDL_SendQuit
();
}
}
// Screen size
extern
"C"
void
Java_org_libsdl_app_SDLActivity_nativeSetScreenSize
(
JNIEnv
*
env
,
jobject
obj
,
jint
width
,
jint
height
)
{
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL: Set screen size on init: %d/%d
\n
"
,
width
,
height
);
Android_SetScreenResolution
(
width
,
height
);
}
// Resize
// Resize
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeResize
(
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeResize
(
JNIEnv
*
env
,
jobject
obj
,
jint
width
,
JNIEnv
*
env
,
jobject
obj
,
jint
width
,
jint
height
,
jint
format
)
jint
height
,
jint
format
)
{
{
/* FIXME: What is the relationship between this and the window? */
Android_SetScreenResolution
(
width
,
height
,
format
);
}
}
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeAccel
(
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeAccel
(
...
@@ -229,3 +218,5 @@ extern "C" void Android_UpdateAudioBuffer(unsigned char *buf, int len)
...
@@ -229,3 +218,5 @@ extern "C" void Android_UpdateAudioBuffer(unsigned char *buf, int len)
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL: invoked
\n
"
);
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL: invoked
\n
"
);
}
}
/* vi: set ts=4 sw=4 expandtab: */
src/video/android/SDL_androidvideo.c
View file @
25101525
...
@@ -56,10 +56,11 @@ extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context);
...
@@ -56,10 +56,11 @@ extern void Android_GL_DeleteContext(_THIS, SDL_GLContext context);
/* Android driver bootstrap functions */
/* Android driver bootstrap functions */
//These are filled in with real values in Android_SetScreenResolution on
// These are filled in with real values in Android_SetScreenResolution on
//init (before SDL_Main())
// init (before SDL_main())
static
int
iScreenWidth
=
320
;
static
Uint32
iScreenFormat
=
SDL_PIXELFORMAT_UNKNOWN
;
static
int
iScreenHeight
=
240
;
static
int
iScreenWidth
=
0
;
static
int
iScreenHeight
=
0
;
static
int
static
int
...
@@ -122,8 +123,7 @@ Android_VideoInit(_THIS)
...
@@ -122,8 +123,7 @@ Android_VideoInit(_THIS)
{
{
SDL_DisplayMode
mode
;
SDL_DisplayMode
mode
;
/* Use a fake 32-bpp desktop mode */
mode
.
format
=
iScreenFormat
;
mode
.
format
=
SDL_PIXELFORMAT_BGR888
;
mode
.
w
=
iScreenWidth
;
mode
.
w
=
iScreenWidth
;
mode
.
h
=
iScreenHeight
;
mode
.
h
=
iScreenHeight
;
mode
.
refresh_rate
=
0
;
mode
.
refresh_rate
=
0
;
...
@@ -146,11 +146,12 @@ Android_VideoQuit(_THIS)
...
@@ -146,11 +146,12 @@ Android_VideoQuit(_THIS)
{
{
}
}
void
void
Android_SetScreenResolution
(
int
width
,
int
height
){
Android_SetScreenResolution
(
int
width
,
int
height
,
Uint32
format
)
{
iScreenWidth
=
width
;
iScreenWidth
=
width
;
iScreenHeight
=
height
;
iScreenHeight
=
height
;
iScreenFormat
=
format
;
}
}
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
src/video/android/SDL_androidvideo.h
View file @
25101525
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
#include "../SDL_sysvideo.h"
#include "../SDL_sysvideo.h"
#endif
/* _SDL_ndsvideo_h */
/* Called by the JNI layer when the screen changes size or format */
extern
void
Android_SetScreenResolution
(
int
width
,
int
height
,
Uint32
format
);
#endif
/* _SDL_androidvideo_h */
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
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