More non C89 compliant comments
parent
63fe3a7753
commit
552b04c58a
|
@ -99,8 +99,8 @@
|
|||
#define HAVE_SQRT 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
//#define HAVE_SYSCONF 1
|
||||
//#define HAVE_SIGACTION 1
|
||||
/*#define HAVE_SYSCONF 1*/
|
||||
/*#define HAVE_SIGACTION 1*/
|
||||
|
||||
|
||||
/* PSP isn't that sophisticated */
|
||||
|
|
|
@ -43,30 +43,30 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
//! Definitions for test case structures
|
||||
/*! Definitions for test case structures*/
|
||||
#define TEST_ENABLED 1
|
||||
#define TEST_DISABLED 0
|
||||
|
||||
//! Definition of all the possible test return values of the test case method
|
||||
/*! Definition of all the possible test return values of the test case method*/
|
||||
#define TEST_ABORTED -1
|
||||
#define TEST_STARTED 0
|
||||
#define TEST_COMPLETED 1
|
||||
#define TEST_SKIPPED 2
|
||||
|
||||
//! Definition of all the possible test results for the harness
|
||||
/*! Definition of all the possible test results for the harness*/
|
||||
#define TEST_RESULT_PASSED 0
|
||||
#define TEST_RESULT_FAILED 1
|
||||
#define TEST_RESULT_NO_ASSERT 2
|
||||
#define TEST_RESULT_SKIPPED 3
|
||||
#define TEST_RESULT_SETUP_FAILURE 4
|
||||
|
||||
//!< Function pointer to a test case setup function (run before every test)
|
||||
/*!< Function pointer to a test case setup function (run before every test)*/
|
||||
typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
|
||||
|
||||
//!< Function pointer to a test case function
|
||||
/*!< Function pointer to a test case function*/
|
||||
typedef int (*SDLTest_TestCaseFp)(void *arg);
|
||||
|
||||
//!< Function pointer to a test case teardown function (run after every test)
|
||||
/*!< Function pointer to a test case teardown function (run after every test)*/
|
||||
typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
|
||||
|
||||
/**
|
||||
|
|
|
@ -510,7 +510,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
if (!valid_format) {
|
||||
DSOUND_CloseDevice(this);
|
||||
if (tried_format) {
|
||||
return -1; // CreateSecondary() should have called SDL_SetError().
|
||||
return -1; /* CreateSecondary() should have called SDL_SetError(). */
|
||||
}
|
||||
return SDL_SetError("DirectSound: Unsupported audio format");
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->spec.freq = 44100;
|
||||
|
||||
/* Update the fragment size as size in bytes. */
|
||||
// SDL_CalculateAudioSpec(this->spec); MOD
|
||||
/* SDL_CalculateAudioSpec(this->spec); MOD*/
|
||||
switch (this->spec.format) {
|
||||
case AUDIO_U8:
|
||||
this->spec.silence = 0x80;
|
||||
|
@ -76,7 +76,7 @@ PSPAUD_OpenDevice(_THIS, const char *devname, int iscapture)
|
|||
this->spec.size *= this->spec.channels;
|
||||
this->spec.size *= this->spec.samples;
|
||||
|
||||
//==========================================
|
||||
/*==========================================*/
|
||||
|
||||
/* Allocate the mixing buffer. Its size and starting address must
|
||||
be a multiple of 64 bytes. Our sample count is already a multiple of
|
||||
|
@ -162,7 +162,7 @@ static int
|
|||
PSPAUD_Init(SDL_AudioDriverImpl * impl)
|
||||
{
|
||||
|
||||
// Set the function pointers
|
||||
/* Set the function pointers*/
|
||||
impl->OpenDevice = PSPAUD_OpenDevice;
|
||||
impl->PlayDevice = PSPAUD_PlayDevice;
|
||||
impl->WaitDevice = PSPAUD_WaitDevice;
|
||||
|
@ -171,7 +171,7 @@ PSPAUD_Init(SDL_AudioDriverImpl * impl)
|
|||
impl->CloseDevice = PSPAUD_CloseDevice;
|
||||
impl->ThreadInit = PSPAUD_ThreadInit;
|
||||
|
||||
//PSP audio device
|
||||
/*PSP audio device*/
|
||||
impl->OnlyHasDefaultOutputDevice = 1;
|
||||
/*
|
||||
impl->HasCaptureSupport = 1;
|
||||
|
|
|
@ -40,13 +40,13 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#define LOG_TAG "SDL_android"
|
||||
//#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
|
||||
//#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
|
||||
/*#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)*/
|
||||
/*#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)*/
|
||||
#define LOGI(...) do {} while (false)
|
||||
#define LOGE(...) do {} while (false)
|
||||
|
||||
/* Uncomment this to log messages entering and exiting methods in this file */
|
||||
//#define DEBUG_JNI
|
||||
/*#define DEBUG_JNI */
|
||||
|
||||
static void Android_JNI_ThreadDestroyed(void*);
|
||||
|
||||
|
@ -64,10 +64,10 @@ static void Android_JNI_ThreadDestroyed(void*);
|
|||
static pthread_key_t mThreadKey;
|
||||
static JavaVM* mJavaVM;
|
||||
|
||||
// Main activity
|
||||
/* Main activity */
|
||||
static jclass mActivityClass;
|
||||
|
||||
// method signatures
|
||||
/* method signatures */
|
||||
static jmethodID midGetNativeSurface;
|
||||
static jmethodID midFlipBuffers;
|
||||
static jmethodID midAudioInit;
|
||||
|
@ -75,7 +75,7 @@ static jmethodID midAudioWriteShortBuffer;
|
|||
static jmethodID midAudioWriteByteBuffer;
|
||||
static jmethodID midAudioQuit;
|
||||
|
||||
// Accelerometer data storage
|
||||
/* Accelerometer data storage */
|
||||
static float fLastAccelerometer[3];
|
||||
static bool bHasNewData;
|
||||
|
||||
|
@ -83,7 +83,7 @@ static bool bHasNewData;
|
|||
Functions called by JNI
|
||||
*******************************************************************************/
|
||||
|
||||
// Library init
|
||||
/* Library init */
|
||||
jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
{
|
||||
JNIEnv *env;
|
||||
|
@ -107,7 +107,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
// Called before SDL_main() to initialize JNI bindings
|
||||
/* Called before SDL_main() to initialize JNI bindings */
|
||||
void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init()");
|
||||
|
@ -138,7 +138,7 @@ void SDL_Android_Init(JNIEnv* mEnv, jclass cls)
|
|||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!");
|
||||
}
|
||||
|
||||
// Resize
|
||||
/* Resize */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeResize(
|
||||
JNIEnv* env, jclass jcls,
|
||||
jint width, jint height, jint format)
|
||||
|
@ -147,7 +147,7 @@ void Java_org_libsdl_app_SDLActivity_onNativeResize(
|
|||
}
|
||||
|
||||
|
||||
// Surface Created
|
||||
/* Surface Created */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass jcls)
|
||||
{
|
||||
SDL_WindowData *data;
|
||||
|
@ -173,7 +173,7 @@ void Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass
|
|||
|
||||
}
|
||||
|
||||
// Surface Destroyed
|
||||
/* Surface Destroyed */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(JNIEnv* env, jclass jcls)
|
||||
{
|
||||
/* We have to clear the current context and destroy the egl surface here
|
||||
|
@ -205,21 +205,21 @@ void Java_org_libsdl_app_SDLActivity_nativeFlipBuffers(JNIEnv* env, jclass jcls)
|
|||
SDL_GL_SwapWindow(Android_Window);
|
||||
}
|
||||
|
||||
// Keydown
|
||||
/* Keydown */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeKeyDown(
|
||||
JNIEnv* env, jclass jcls, jint keycode)
|
||||
{
|
||||
Android_OnKeyDown(keycode);
|
||||
}
|
||||
|
||||
// Keyup
|
||||
/* Keyup */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeKeyUp(
|
||||
JNIEnv* env, jclass jcls, jint keycode)
|
||||
{
|
||||
Android_OnKeyUp(keycode);
|
||||
}
|
||||
|
||||
// Keyboard Focus Lost
|
||||
/* Keyboard Focus Lost */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost(
|
||||
JNIEnv* env, jclass jcls)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ void Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost(
|
|||
}
|
||||
|
||||
|
||||
// Touch
|
||||
/* Touch */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeTouch(
|
||||
JNIEnv* env, jclass jcls,
|
||||
jint touch_device_id_in, jint pointer_finger_id_in,
|
||||
|
@ -237,7 +237,7 @@ void Java_org_libsdl_app_SDLActivity_onNativeTouch(
|
|||
Android_OnTouch(touch_device_id_in, pointer_finger_id_in, action, x, y, p);
|
||||
}
|
||||
|
||||
// Accelerometer
|
||||
/* Accelerometer */
|
||||
void Java_org_libsdl_app_SDLActivity_onNativeAccel(
|
||||
JNIEnv* env, jclass jcls,
|
||||
jfloat x, jfloat y, jfloat z)
|
||||
|
@ -248,23 +248,23 @@ void Java_org_libsdl_app_SDLActivity_onNativeAccel(
|
|||
bHasNewData = true;
|
||||
}
|
||||
|
||||
// Low memory
|
||||
/* Low memory */
|
||||
void Java_org_libsdl_app_SDLActivity_nativeLowMemory(
|
||||
JNIEnv* env, jclass cls)
|
||||
{
|
||||
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
|
||||
}
|
||||
|
||||
// Quit
|
||||
/* Quit */
|
||||
void Java_org_libsdl_app_SDLActivity_nativeQuit(
|
||||
JNIEnv* env, jclass cls)
|
||||
{
|
||||
// Inject a SDL_QUIT event
|
||||
/* Inject a SDL_QUIT event */
|
||||
SDL_SendQuit();
|
||||
SDL_SendAppEvent(SDL_APP_TERMINATING);
|
||||
}
|
||||
|
||||
// Pause
|
||||
/* Pause */
|
||||
void Java_org_libsdl_app_SDLActivity_nativePause(
|
||||
JNIEnv* env, jclass cls)
|
||||
{
|
||||
|
@ -280,7 +280,7 @@ void Java_org_libsdl_app_SDLActivity_nativePause(
|
|||
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
|
||||
}
|
||||
|
||||
// Resume
|
||||
/* Resume */
|
||||
void Java_org_libsdl_app_SDLActivity_nativeResume(
|
||||
JNIEnv* env, jclass cls)
|
||||
{
|
||||
|
@ -468,9 +468,9 @@ int Android_JNI_SetupThread(void) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Audio support
|
||||
//
|
||||
/*
|
||||
* Audio support
|
||||
*/
|
||||
static jboolean audioBuffer16Bit = JNI_FALSE;
|
||||
static jboolean audioBufferStereo = JNI_FALSE;
|
||||
static jobject audioBuffer = NULL;
|
||||
|
@ -568,8 +568,8 @@ void Android_JNI_CloseAudioDevice()
|
|||
}
|
||||
}
|
||||
|
||||
// Test for an exception and call SDL_SetError with its detail if one occurs
|
||||
// If the parameter silent is truthy then SDL_SetError() will not be called.
|
||||
/* Test for an exception and call SDL_SetError with its detail if one occurs */
|
||||
/* If the parameter silent is truthy then SDL_SetError() will not be called. */
|
||||
static bool Android_JNI_ExceptionOccurred(bool silent)
|
||||
{
|
||||
SDL_assert(LocalReferenceHolder_IsActive());
|
||||
|
@ -579,7 +579,7 @@ static bool Android_JNI_ExceptionOccurred(bool silent)
|
|||
if (exception != NULL) {
|
||||
jmethodID mid;
|
||||
|
||||
// Until this happens most JNI operations have undefined behaviour
|
||||
/* Until this happens most JNI operations have undefined behaviour */
|
||||
(*mEnv)->ExceptionClear(mEnv);
|
||||
|
||||
if (!silent) {
|
||||
|
@ -635,13 +635,13 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
|
|||
fileNameJString = (jstring)ctx->hidden.androidio.fileNameRef;
|
||||
ctx->hidden.androidio.position = 0;
|
||||
|
||||
// context = SDLActivity.getContext();
|
||||
/* context = SDLActivity.getContext(); */
|
||||
mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,
|
||||
"getContext","()Landroid/content/Context;");
|
||||
context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, mid);
|
||||
|
||||
|
||||
// assetManager = context.getAssets();
|
||||
/* assetManager = context.getAssets(); */
|
||||
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context),
|
||||
"getAssets", "()Landroid/content/res/AssetManager;");
|
||||
assetManager = (*mEnv)->CallObjectMethod(mEnv, context, mid);
|
||||
|
@ -674,18 +674,18 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx)
|
|||
ctx->hidden.androidio.fd = (*mEnv)->GetIntField(mEnv, fd, descriptor);
|
||||
ctx->hidden.androidio.assetFileDescriptorRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
|
||||
|
||||
// Seek to the correct offset in the file.
|
||||
/* Seek to the correct offset in the file. */
|
||||
lseek(ctx->hidden.androidio.fd, (off_t)ctx->hidden.androidio.offset, SEEK_SET);
|
||||
|
||||
if (false) {
|
||||
fallback:
|
||||
// Disabled log message because of spam on the Nexus 7
|
||||
//__android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file");
|
||||
/* Disabled log message because of spam on the Nexus 7 */
|
||||
/*__android_log_print(ANDROID_LOG_DEBUG, "SDL", "Falling back to legacy InputStream method for opening file");*/
|
||||
|
||||
/* Try the old method using InputStream */
|
||||
ctx->hidden.androidio.assetFileDescriptorRef = NULL;
|
||||
|
||||
// inputStream = assetManager.open(<filename>);
|
||||
/* inputStream = assetManager.open(<filename>); */
|
||||
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, assetManager),
|
||||
"open", "(Ljava/lang/String;I)Ljava/io/InputStream;");
|
||||
inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /*ACCESS_RANDOM*/);
|
||||
|
@ -695,13 +695,14 @@ fallback:
|
|||
|
||||
ctx->hidden.androidio.inputStreamRef = (*mEnv)->NewGlobalRef(mEnv, inputStream);
|
||||
|
||||
// Despite all the visible documentation on [Asset]InputStream claiming
|
||||
// that the .available() method is not guaranteed to return the entire file
|
||||
// size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
|
||||
// android/apis/content/ReadAsset.java imply that Android's
|
||||
// AssetInputStream.available() /will/ always return the total file size
|
||||
/* Despite all the visible documentation on [Asset]InputStream claiming
|
||||
* that the .available() method is not guaranteed to return the entire file
|
||||
* size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
|
||||
* android/apis/content/ReadAsset.java imply that Android's
|
||||
* AssetInputStream.available() /will/ always return the total file size
|
||||
*/
|
||||
|
||||
// size = inputStream.available();
|
||||
/* size = inputStream.available(); */
|
||||
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream),
|
||||
"available", "()I");
|
||||
ctx->hidden.androidio.size = (long)(*mEnv)->CallIntMethod(mEnv, inputStream, mid);
|
||||
|
@ -709,7 +710,7 @@ fallback:
|
|||
goto failure;
|
||||
}
|
||||
|
||||
// readableByteChannel = Channels.newChannel(inputStream);
|
||||
/* readableByteChannel = Channels.newChannel(inputStream); */
|
||||
channels = (*mEnv)->FindClass(mEnv, "java/nio/channels/Channels");
|
||||
mid = (*mEnv)->GetStaticMethodID(mEnv, channels,
|
||||
"newChannel",
|
||||
|
@ -723,7 +724,7 @@ fallback:
|
|||
ctx->hidden.androidio.readableByteChannelRef =
|
||||
(*mEnv)->NewGlobalRef(mEnv, readableByteChannel);
|
||||
|
||||
// Store .read id for reading purposes
|
||||
/* Store .read id for reading purposes */
|
||||
mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, readableByteChannel),
|
||||
"read", "(Ljava/nio/ByteBuffer;)I");
|
||||
ctx->hidden.androidio.readMethod = mid;
|
||||
|
@ -819,7 +820,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer,
|
|||
jobject byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining);
|
||||
|
||||
while (bytesRemaining > 0) {
|
||||
// result = readableByteChannel.read(...);
|
||||
/* result = readableByteChannel.read(...); */
|
||||
int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer);
|
||||
|
||||
if (Android_JNI_ExceptionOccurred(false)) {
|
||||
|
@ -877,7 +878,7 @@ static int Internal_Android_JNI_FileClose(SDL_RWops* ctx, bool release)
|
|||
else {
|
||||
jobject inputStream = (jobject)ctx->hidden.androidio.inputStreamRef;
|
||||
|
||||
// inputStream.close();
|
||||
/* inputStream.close();*/
|
||||
jmethodID mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream),
|
||||
"close", "()V");
|
||||
(*mEnv)->CallVoidMethod(mEnv, inputStream, mid);
|
||||
|
@ -956,7 +957,7 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
|
|||
if (movement > 0) {
|
||||
unsigned char buffer[4096];
|
||||
|
||||
// The easy case where we're seeking forwards
|
||||
/* The easy case where we're seeking forwards */
|
||||
while (movement > 0) {
|
||||
Sint64 amount = sizeof (buffer);
|
||||
if (amount > movement) {
|
||||
|
@ -964,7 +965,7 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
|
|||
}
|
||||
size_t result = Android_JNI_FileRead(ctx, buffer, 1, amount);
|
||||
if (result <= 0) {
|
||||
// Failed to read/skip the required amount, so fail
|
||||
/* Failed to read/skip the required amount, so fail */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -972,8 +973,8 @@ Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence)
|
|||
}
|
||||
|
||||
} else if (movement < 0) {
|
||||
// We can't seek backwards so we have to reopen the file and seek
|
||||
// forwards which obviously isn't very efficient
|
||||
/* We can't seek backwards so we have to reopen the file and seek */
|
||||
/* forwards which obviously isn't very efficient */
|
||||
Internal_Android_JNI_FileClose(ctx, false);
|
||||
Internal_Android_JNI_FileOpen(ctx);
|
||||
Android_JNI_FileSeek(ctx, newPosition, RW_SEEK_SET);
|
||||
|
@ -989,7 +990,7 @@ int Android_JNI_FileClose(SDL_RWops* ctx)
|
|||
return Internal_Android_JNI_FileClose(ctx, true);
|
||||
}
|
||||
|
||||
// returns a new global reference which needs to be released later
|
||||
/* returns a new global reference which needs to be released later */
|
||||
static jobject Android_JNI_GetSystemServiceObject(const char* name)
|
||||
{
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
|
@ -1089,9 +1090,10 @@ SDL_bool Android_JNI_HasClipboardText()
|
|||
}
|
||||
|
||||
|
||||
// returns 0 on success or -1 on error (others undefined then)
|
||||
// returns truthy or falsy value in plugged, charged and battery
|
||||
// returns the value in seconds and percent or -1 if not available
|
||||
/* returns 0 on success or -1 on error (others undefined then)
|
||||
* returns truthy or falsy value in plugged, charged and battery
|
||||
* returns the value in seconds and percent or -1 if not available
|
||||
*/
|
||||
int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent)
|
||||
{
|
||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||
|
@ -1139,38 +1141,38 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco
|
|||
(*env)->DeleteLocalRef(env, bname);
|
||||
|
||||
if (plugged) {
|
||||
GET_INT_EXTRA(plug, "plugged") // == BatteryManager.EXTRA_PLUGGED (API 5)
|
||||
GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */
|
||||
if (plug == -1) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return -1;
|
||||
}
|
||||
// 1 == BatteryManager.BATTERY_PLUGGED_AC
|
||||
// 2 == BatteryManager.BATTERY_PLUGGED_USB
|
||||
/* 1 == BatteryManager.BATTERY_PLUGGED_AC */
|
||||
/* 2 == BatteryManager.BATTERY_PLUGGED_USB */
|
||||
*plugged = (0 < plug) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (charged) {
|
||||
GET_INT_EXTRA(status, "status") // == BatteryManager.EXTRA_STATUS (API 5)
|
||||
GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */
|
||||
if (status == -1) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return -1;
|
||||
}
|
||||
// 5 == BatteryManager.BATTERY_STATUS_FULL
|
||||
/* 5 == BatteryManager.BATTERY_STATUS_FULL */
|
||||
*charged = (status == 5) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (battery) {
|
||||
GET_BOOL_EXTRA(present, "present") // == BatteryManager.EXTRA_PRESENT (API 5)
|
||||
GET_BOOL_EXTRA(present, "present") /* == BatteryManager.EXTRA_PRESENT (API 5) */
|
||||
*battery = present ? 1 : 0;
|
||||
}
|
||||
|
||||
if (seconds) {
|
||||
*seconds = -1; // not possible
|
||||
*seconds = -1; /* not possible */
|
||||
}
|
||||
|
||||
if (percent) {
|
||||
GET_INT_EXTRA(level, "level") // == BatteryManager.EXTRA_LEVEL (API 5)
|
||||
GET_INT_EXTRA(scale, "scale") // == BatteryManager.EXTRA_SCALE (API 5)
|
||||
GET_INT_EXTRA(level, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */
|
||||
GET_INT_EXTRA(scale, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */
|
||||
if ((level == -1) || (scale == -1)) {
|
||||
LocalReferenceHolder_Cleanup(&refs);
|
||||
return -1;
|
||||
|
@ -1184,7 +1186,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco
|
|||
return 0;
|
||||
}
|
||||
|
||||
// sends message to be handled on the UI event dispatch thread
|
||||
/* sends message to be handled on the UI event dispatch thread */
|
||||
int Android_JNI_SendMessage(int command, int param)
|
||||
{
|
||||
JNIEnv *env = Android_JNI_GetEnv();
|
||||
|
@ -1219,15 +1221,17 @@ void Android_JNI_ShowTextInput(SDL_Rect *inputRect)
|
|||
|
||||
void Android_JNI_HideTextInput()
|
||||
{
|
||||
// has to match Activity constant
|
||||
/* has to match Activity constant */
|
||||
const int COMMAND_TEXTEDIT_HIDE = 3;
|
||||
Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Functions exposed to SDL applications in SDL_system.h
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
void *SDL_AndroidGetJNIEnv()
|
||||
{
|
||||
|
@ -1247,7 +1251,7 @@ void *SDL_AndroidGetActivity()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// return SDLActivity.getContext();
|
||||
/* return SDLActivity.getContext(); */
|
||||
mid = (*env)->GetStaticMethodID(env, mActivityClass,
|
||||
"getContext","()Landroid/content/Context;");
|
||||
return (*env)->CallStaticObjectMethod(env, mActivityClass, mid);
|
||||
|
@ -1271,12 +1275,12 @@ const char * SDL_AndroidGetInternalStoragePath()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// context = SDLActivity.getContext();
|
||||
/* context = SDLActivity.getContext(); */
|
||||
mid = (*env)->GetStaticMethodID(env, mActivityClass,
|
||||
"getContext","()Landroid/content/Context;");
|
||||
context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid);
|
||||
|
||||
// fileObj = context.getFilesDir();
|
||||
/* fileObj = context.getFilesDir(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
|
||||
"getFilesDir", "()Ljava/io/File;");
|
||||
fileObject = (*env)->CallObjectMethod(env, context, mid);
|
||||
|
@ -1286,7 +1290,7 @@ const char * SDL_AndroidGetInternalStoragePath()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// path = fileObject.getAbsolutePath();
|
||||
/* path = fileObject.getAbsolutePath(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject),
|
||||
"getAbsolutePath", "()Ljava/lang/String;");
|
||||
pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid);
|
||||
|
@ -1322,7 +1326,7 @@ int SDL_AndroidGetExternalStorageState()
|
|||
|
||||
state = (*env)->GetStringUTFChars(env, stateString, NULL);
|
||||
|
||||
// Print an info message so people debugging know the storage state
|
||||
/* Print an info message so people debugging know the storage state */
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "external storage state: %s", state);
|
||||
|
||||
if (SDL_strcmp(state, "mounted") == 0) {
|
||||
|
@ -1357,12 +1361,12 @@ const char * SDL_AndroidGetExternalStoragePath()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// context = SDLActivity.getContext();
|
||||
/* context = SDLActivity.getContext(); */
|
||||
mid = (*env)->GetStaticMethodID(env, mActivityClass,
|
||||
"getContext","()Landroid/content/Context;");
|
||||
context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid);
|
||||
|
||||
// fileObj = context.getExternalFilesDir();
|
||||
/* fileObj = context.getExternalFilesDir(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context),
|
||||
"getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;");
|
||||
fileObject = (*env)->CallObjectMethod(env, context, mid, NULL);
|
||||
|
@ -1372,7 +1376,7 @@ const char * SDL_AndroidGetExternalStoragePath()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// path = fileObject.getAbsolutePath();
|
||||
/* path = fileObject.getAbsolutePath(); */
|
||||
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject),
|
||||
"getAbsolutePath", "()Ljava/lang/String;");
|
||||
pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid);
|
||||
|
|
|
@ -26,30 +26,30 @@
|
|||
/* *INDENT-OFF* */
|
||||
static const SDL_Scancode windows_scancode_table[] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// 8 9 A B C D E F
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, // 0
|
||||
SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, // 0
|
||||
/* 0 1 2 3 4 5 6 7 */
|
||||
/* 8 9 A B C D E F */
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_ESCAPE, SDL_SCANCODE_1, SDL_SCANCODE_2, SDL_SCANCODE_3, SDL_SCANCODE_4, SDL_SCANCODE_5, SDL_SCANCODE_6, /* 0 */
|
||||
SDL_SCANCODE_7, SDL_SCANCODE_8, SDL_SCANCODE_9, SDL_SCANCODE_0, SDL_SCANCODE_MINUS, SDL_SCANCODE_EQUALS, SDL_SCANCODE_BACKSPACE, SDL_SCANCODE_TAB, /* 0 */
|
||||
|
||||
SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, // 1
|
||||
SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, // 1
|
||||
SDL_SCANCODE_Q, SDL_SCANCODE_W, SDL_SCANCODE_E, SDL_SCANCODE_R, SDL_SCANCODE_T, SDL_SCANCODE_Y, SDL_SCANCODE_U, SDL_SCANCODE_I, /* 1 */
|
||||
SDL_SCANCODE_O, SDL_SCANCODE_P, SDL_SCANCODE_LEFTBRACKET, SDL_SCANCODE_RIGHTBRACKET, SDL_SCANCODE_RETURN, SDL_SCANCODE_LCTRL, SDL_SCANCODE_A, SDL_SCANCODE_S, /* 1 */
|
||||
|
||||
SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, // 2
|
||||
SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, // 2
|
||||
SDL_SCANCODE_D, SDL_SCANCODE_F, SDL_SCANCODE_G, SDL_SCANCODE_H, SDL_SCANCODE_J, SDL_SCANCODE_K, SDL_SCANCODE_L, SDL_SCANCODE_SEMICOLON, /* 2 */
|
||||
SDL_SCANCODE_APOSTROPHE, SDL_SCANCODE_GRAVE, SDL_SCANCODE_LSHIFT, SDL_SCANCODE_BACKSLASH, SDL_SCANCODE_Z, SDL_SCANCODE_X, SDL_SCANCODE_C, SDL_SCANCODE_V, /* 2 */
|
||||
|
||||
SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,// 3
|
||||
SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, // 3
|
||||
SDL_SCANCODE_B, SDL_SCANCODE_N, SDL_SCANCODE_M, SDL_SCANCODE_COMMA, SDL_SCANCODE_PERIOD, SDL_SCANCODE_SLASH, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_PRINTSCREEN,/* 3 */
|
||||
SDL_SCANCODE_LALT, SDL_SCANCODE_SPACE, SDL_SCANCODE_CAPSLOCK, SDL_SCANCODE_F1, SDL_SCANCODE_F2, SDL_SCANCODE_F3, SDL_SCANCODE_F4, SDL_SCANCODE_F5, /* 3 */
|
||||
|
||||
SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, // 4
|
||||
SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, // 4
|
||||
SDL_SCANCODE_F6, SDL_SCANCODE_F7, SDL_SCANCODE_F8, SDL_SCANCODE_F9, SDL_SCANCODE_F10, SDL_SCANCODE_NUMLOCKCLEAR, SDL_SCANCODE_SCROLLLOCK, SDL_SCANCODE_HOME, /* 4 */
|
||||
SDL_SCANCODE_UP, SDL_SCANCODE_PAGEUP, SDL_SCANCODE_KP_MINUS, SDL_SCANCODE_LEFT, SDL_SCANCODE_KP_5, SDL_SCANCODE_RIGHT, SDL_SCANCODE_KP_PLUS, SDL_SCANCODE_END, /* 4 */
|
||||
|
||||
SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, // 5
|
||||
SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 5
|
||||
SDL_SCANCODE_DOWN, SDL_SCANCODE_PAGEDOWN, SDL_SCANCODE_INSERT, SDL_SCANCODE_DELETE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_NONUSBACKSLASH,SDL_SCANCODE_F11, /* 5 */
|
||||
SDL_SCANCODE_F12, SDL_SCANCODE_PAUSE, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_LGUI, SDL_SCANCODE_RGUI, SDL_SCANCODE_APPLICATION, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 5 */
|
||||
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, // 6
|
||||
SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 6
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_F13, SDL_SCANCODE_F14, SDL_SCANCODE_F15, SDL_SCANCODE_F16, /* 6 */
|
||||
SDL_SCANCODE_F17, SDL_SCANCODE_F18, SDL_SCANCODE_F19, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 6 */
|
||||
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, // 7
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN // 7
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, /* 7 */
|
||||
SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN, SDL_SCANCODE_UNKNOWN /* 7 */
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
|
|
@ -433,8 +433,8 @@ BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput )
|
|||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
// Check for well known XInput device GUIDs
|
||||
// We need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list.
|
||||
/* Check for well known XInput device GUIDs */
|
||||
/* We need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. */
|
||||
for ( iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice ) {
|
||||
if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) {
|
||||
return SDL_TRUE;
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
*******************************************************************************/
|
||||
#include <jni.h>
|
||||
|
||||
// Called before SDL_main() to initialize JNI bindings in SDL library
|
||||
/* Called before SDL_main() to initialize JNI bindings in SDL library */
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
|
||||
// Start up the SDL app
|
||||
/* Start up the SDL app */
|
||||
void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
||||
{
|
||||
/* This interface could expand with ABI negotiation, calbacks, etc. */
|
||||
|
@ -30,7 +30,7 @@ void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject
|
|||
status = SDL_main(1, argv);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
//exit(status);
|
||||
/*exit(status);*/
|
||||
}
|
||||
|
||||
#endif /* __ANDROID__ */
|
||||
|
|
|
@ -1033,7 +1033,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
HRESULT result;
|
||||
|
||||
if (data->yuv) {
|
||||
// It's more efficient to upload directly...
|
||||
/* It's more efficient to upload directly... */
|
||||
if (!data->pixels) {
|
||||
data->pitch = texture->w;
|
||||
data->pixels = (Uint8 *)SDL_malloc((texture->h * data->pitch * 3) / 2);
|
||||
|
|
|
@ -458,7 +458,7 @@ PSP_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
|
|||
static int
|
||||
PSP_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
{
|
||||
// PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;
|
||||
/* PSP_RenderData *renderdata = (PSP_RenderData *) renderer->driverdata;*/
|
||||
PSP_TextureData* psp_texture = (PSP_TextureData*) SDL_calloc(1, sizeof(*psp_texture));;
|
||||
|
||||
if(!psp_texture)
|
||||
|
@ -528,7 +528,7 @@ static int
|
|||
PSP_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
const SDL_Rect * rect, const void *pixels, int pitch)
|
||||
{
|
||||
// PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;
|
||||
/* PSP_TextureData *psp_texture = (PSP_TextureData *) texture->driverdata;*/
|
||||
const Uint8 *src;
|
||||
Uint8 *dst;
|
||||
int row, length,dpitch;
|
||||
|
@ -895,8 +895,8 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
sceGuColor(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
// x += width * 0.5f;
|
||||
// y += height * 0.5f;
|
||||
/* x += width * 0.5f;*/
|
||||
/* y += height * 0.5f;*/
|
||||
x += centerx;
|
||||
y += centery;
|
||||
|
||||
|
@ -904,8 +904,8 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
|
||||
MathSincos(degToRad(angle), &s, &c);
|
||||
|
||||
// width *= 0.5f;
|
||||
// height *= 0.5f;
|
||||
/* width *= 0.5f;*/
|
||||
/* height *= 0.5f;*/
|
||||
width -= centerx;
|
||||
height -= centery;
|
||||
|
||||
|
@ -968,7 +968,7 @@ PSP_RenderPresent(SDL_Renderer * renderer)
|
|||
sceGuFinish();
|
||||
sceGuSync(0,0);
|
||||
|
||||
// if(data->vsync)
|
||||
/* if(data->vsync)*/
|
||||
sceDisplayWaitVblankStart();
|
||||
|
||||
data->backbuffer = data->frontbuffer;
|
||||
|
@ -1007,8 +1007,8 @@ PSP_DestroyRenderer(SDL_Renderer * renderer)
|
|||
StartDrawing(renderer);
|
||||
|
||||
sceGuTerm();
|
||||
// vfree(data->backbuffer);
|
||||
// vfree(data->frontbuffer);
|
||||
/* vfree(data->backbuffer);*/
|
||||
/* vfree(data->frontbuffer);*/
|
||||
|
||||
data->initialized = SDL_FALSE;
|
||||
data->displayListAvail = SDL_FALSE;
|
||||
|
|
|
@ -353,7 +353,7 @@ class SDL_BWin:public BDirectWindow
|
|||
- CTRL+Q to close window (and other shortcuts)
|
||||
- PrintScreen to make screenshot into /boot/home
|
||||
- etc.. */
|
||||
//BDirectWindow::DispatchMessage(msg, target);
|
||||
/*BDirectWindow::DispatchMessage(msg, target);*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -461,9 +461,9 @@ private:
|
|||
msg.AddBool("focusGained", focusGained);
|
||||
_PostWindowEvent(msg);
|
||||
|
||||
//FIXME: Why were these here?
|
||||
// if false: be_app->SetCursor(B_HAND_CURSOR);
|
||||
// if true: SDL_SetCursor(NULL);
|
||||
/*FIXME: Why were these here?
|
||||
if false: be_app->SetCursor(B_HAND_CURSOR);
|
||||
if true: SDL_SetCursor(NULL);*/
|
||||
}
|
||||
|
||||
void _MouseButtonEvent(int32 buttons) {
|
||||
|
|
|
@ -29,13 +29,13 @@ extern "C" {
|
|||
#include "../SDL_sysvideo.h"
|
||||
|
||||
|
||||
extern int BE_GL_LoadLibrary(_THIS, const char *path); //FIXME
|
||||
extern void *BE_GL_GetProcAddress(_THIS, const char *proc); //FIXME
|
||||
extern void BE_GL_UnloadLibrary(_THIS); //TODO
|
||||
extern int BE_GL_LoadLibrary(_THIS, const char *path); /*FIXME*/
|
||||
extern void *BE_GL_GetProcAddress(_THIS, const char *proc); /*FIXME*/
|
||||
extern void BE_GL_UnloadLibrary(_THIS); /*TODO*/
|
||||
extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window,
|
||||
SDL_GLContext context);
|
||||
extern int BE_GL_SetSwapInterval(_THIS, int interval); //TODO
|
||||
extern int BE_GL_GetSwapInterval(_THIS); //TODO
|
||||
extern int BE_GL_SetSwapInterval(_THIS, int interval); /*TODO*/
|
||||
extern int BE_GL_GetSwapInterval(_THIS); /*TODO*/
|
||||
extern void BE_GL_SwapWindow(_THIS, SDL_Window * window);
|
||||
extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window);
|
||||
extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context);
|
||||
|
|
|
@ -533,7 +533,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
/* no break */
|
||||
case WM_CHAR:
|
||||
{
|
||||
char text[5];
|
||||
|
|
|
@ -157,7 +157,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
|
|||
int w = rect.right;
|
||||
int h = rect.bottom;
|
||||
if ((window->w && window->w != w) || (window->h && window->h != h)) {
|
||||
// We tried to create a window larger than the desktop and Windows didn't allow it. Override!
|
||||
/* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */
|
||||
WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
} else {
|
||||
window->w = w;
|
||||
|
|
|
@ -79,16 +79,16 @@ static int main_testImpliedJoystickInit (void *arg)
|
|||
#else
|
||||
int initialized_system;
|
||||
|
||||
// First initialize the controller
|
||||
/* First initialize the controller */
|
||||
SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
|
||||
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
|
||||
|
||||
// Then make sure this implicitly initialized the joystick subsystem
|
||||
/* Then make sure this implicitly initialized the joystick subsystem */
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
|
||||
|
||||
// Then quit the controller, and make sure that implicitly also quits the
|
||||
// joystick subsystem
|
||||
/* Then quit the controller, and make sure that implicitly also quits the */
|
||||
/* joystick subsystem */
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == 0, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
|
||||
|
@ -104,17 +104,17 @@ static int main_testImpliedJoystickQuit (void *arg)
|
|||
#else
|
||||
int initialized_system;
|
||||
|
||||
// First initialize the controller and the joystick (explicitly)
|
||||
/* First initialize the controller and the joystick (explicitly) */
|
||||
SDLTest_AssertCheck( (SDL_WasInit(joy_and_controller) & joy_and_controller) == 0, "SDL_WasInit() before init should be false for joystick & controller" );
|
||||
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0, "SDL_InitSubSystem(SDL_INIT_JOYSTICK)" );
|
||||
SDLTest_AssertCheck( SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == 0, "SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER)" );
|
||||
|
||||
// Then make sure they're both initialized properly
|
||||
/* Then make sure they're both initialized properly */
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == joy_and_controller, "SDL_WasInit() should be true for joystick & controller (%x)", initialized_system );
|
||||
|
||||
// Then quit the controller, and make sure that it does NOT quit the
|
||||
// explicitly initialized joystick subsystem.
|
||||
/* Then quit the controller, and make sure that it does NOT quit the */
|
||||
/* explicitly initialized joystick subsystem. */
|
||||
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
|
||||
initialized_system = SDL_WasInit(joy_and_controller);
|
||||
SDLTest_AssertCheck( (initialized_system & joy_and_controller) == SDL_INIT_JOYSTICK, "SDL_WasInit() should be false for joystick & controller (%x)", initialized_system );
|
||||
|
|
|
@ -168,7 +168,7 @@ int platform_testHasFunctions (void *arg)
|
|||
{
|
||||
int ret;
|
||||
|
||||
// TODO: independently determine and compare values as well
|
||||
/* TODO: independently determine and compare values as well */
|
||||
|
||||
ret = SDL_HasRDTSC();
|
||||
SDLTest_AssertPass("SDL_HasRDTSC()");
|
||||
|
@ -315,7 +315,7 @@ int platform_testGetSetClearError(void *arg)
|
|||
lastError);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
/* Clean up */
|
||||
SDL_ClearError();
|
||||
SDLTest_AssertPass("SDL_ClearError()");
|
||||
|
||||
|
@ -351,7 +351,7 @@ int platform_testSetErrorEmptyInput(void *arg)
|
|||
lastError);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
/* Clean up */
|
||||
SDL_ClearError();
|
||||
SDLTest_AssertPass("SDL_ClearError()");
|
||||
|
||||
|
@ -370,11 +370,11 @@ int platform_testSetErrorInvalidInput(void *arg)
|
|||
char *lastError;
|
||||
int len;
|
||||
|
||||
// Reset
|
||||
/* Reset */
|
||||
SDL_ClearError();
|
||||
SDLTest_AssertPass("SDL_ClearError()");
|
||||
|
||||
// Check for no-op
|
||||
/* Check for no-op */
|
||||
SDL_SetError(testError);
|
||||
SDLTest_AssertPass("SDL_SetError()");
|
||||
lastError = (char *)SDL_GetError();
|
||||
|
@ -392,11 +392,11 @@ int platform_testSetErrorInvalidInput(void *arg)
|
|||
lastError);
|
||||
}
|
||||
|
||||
// Set
|
||||
/* Set */
|
||||
SDL_SetError(probeError);
|
||||
SDLTest_AssertPass("SDL_SetError()");
|
||||
|
||||
// Check for no-op
|
||||
/* Check for no-op */
|
||||
SDL_SetError(testError);
|
||||
SDLTest_AssertPass("SDL_SetError()");
|
||||
lastError = (char *)SDL_GetError();
|
||||
|
@ -415,7 +415,7 @@ int platform_testSetErrorInvalidInput(void *arg)
|
|||
lastError);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
/* Clean up */
|
||||
SDL_ClearError();
|
||||
SDLTest_AssertPass("SDL_ClearError()");
|
||||
|
||||
|
@ -472,7 +472,7 @@ int platform_testGetPowerInfo(void *arg)
|
|||
pct);
|
||||
}
|
||||
|
||||
// Partial return value variations
|
||||
/* Partial return value variations */
|
||||
stateAgain = SDL_GetPowerInfo(&secsAgain, NULL);
|
||||
SDLTest_AssertCheck(
|
||||
state==stateAgain,
|
||||
|
|
|
@ -423,7 +423,7 @@ int rect_testIntersectRectInside (void *arg)
|
|||
SDL_Rect result;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB fully contained in rectA
|
||||
/* rectB fully contained in rectA */
|
||||
refRectB.x = 0;
|
||||
refRectB.y = 0;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
||||
|
@ -451,7 +451,7 @@ int rect_testIntersectRectOutside (void *arg)
|
|||
SDL_Rect result;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB fully outside of rectA
|
||||
/* rectB fully outside of rectA */
|
||||
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
|
||||
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -480,7 +480,7 @@ int rect_testIntersectRectPartial (void *arg)
|
|||
SDL_Rect expectedResult;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB partially contained in rectA
|
||||
/* rectB partially contained in rectA */
|
||||
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
||||
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -494,7 +494,7 @@ int rect_testIntersectRectPartial (void *arg)
|
|||
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
||||
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
||||
|
||||
// rectB right edge
|
||||
/* rectB right edge */
|
||||
refRectB.x = rectA.w - 1;
|
||||
refRectB.y = rectA.y;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -508,7 +508,7 @@ int rect_testIntersectRectPartial (void *arg)
|
|||
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
||||
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
||||
|
||||
// rectB left edge
|
||||
/* rectB left edge */
|
||||
refRectB.x = 1 - rectA.w;
|
||||
refRectB.y = rectA.y;
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -522,7 +522,7 @@ int rect_testIntersectRectPartial (void *arg)
|
|||
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
||||
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
||||
|
||||
// rectB bottom edge
|
||||
/* rectB bottom edge */
|
||||
refRectB.x = rectA.x;
|
||||
refRectB.y = rectA.h - 1;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -536,7 +536,7 @@ int rect_testIntersectRectPartial (void *arg)
|
|||
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
||||
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &expectedResult);
|
||||
|
||||
// rectB top edge
|
||||
/* rectB top edge */
|
||||
refRectB.x = rectA.x;
|
||||
refRectB.y = 1 - rectA.h;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -569,7 +569,7 @@ int rect_testIntersectRectPoint (void *arg)
|
|||
SDL_bool intersection;
|
||||
int offsetX, offsetY;
|
||||
|
||||
// intersecting pixels
|
||||
/* intersecting pixels */
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectB.x = refRectA.x;
|
||||
|
@ -579,7 +579,7 @@ int rect_testIntersectRectPoint (void *arg)
|
|||
intersection = SDL_IntersectRect(&rectA, &rectB, &result);
|
||||
_validateIntersectRectResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB, &result, &refRectA);
|
||||
|
||||
// non-intersecting pixels cases
|
||||
/* non-intersecting pixels cases */
|
||||
for (offsetX = -1; offsetX <= 1; offsetX++) {
|
||||
for (offsetY = -1; offsetY <= 1; offsetY++) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
|
@ -616,7 +616,7 @@ int rect_testIntersectRectEmpty (void *arg)
|
|||
SDL_bool intersection;
|
||||
SDL_bool empty;
|
||||
|
||||
// Rect A empty
|
||||
/* Rect A empty */
|
||||
result.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
result.h = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -633,7 +633,7 @@ int rect_testIntersectRectEmpty (void *arg)
|
|||
empty = (SDL_bool)SDL_RectEmpty(&result);
|
||||
SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
||||
|
||||
// Rect B empty
|
||||
/* Rect B empty */
|
||||
result.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
result.h = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -650,7 +650,7 @@ int rect_testIntersectRectEmpty (void *arg)
|
|||
empty = (SDL_bool)SDL_RectEmpty(&result);
|
||||
SDLTest_AssertCheck(empty == SDL_TRUE, "Validate result is empty Rect; got: %s", (empty == SDL_TRUE) ? "SDL_TRUE" : "SDL_FALSE");
|
||||
|
||||
// Rect A and B empty
|
||||
/* Rect A and B empty */
|
||||
result.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
result.h = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -685,7 +685,7 @@ int rect_testIntersectRectParam(void *arg)
|
|||
SDL_Rect result;
|
||||
SDL_bool intersection;
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
intersection = SDL_IntersectRect((SDL_Rect *)NULL, &rectB, &result);
|
||||
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
||||
intersection = SDL_IntersectRect(&rectA, (SDL_Rect *)NULL, &result);
|
||||
|
@ -716,7 +716,7 @@ int rect_testHasIntersectionInside (void *arg)
|
|||
SDL_Rect rectB;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB fully contained in rectA
|
||||
/* rectB fully contained in rectA */
|
||||
refRectB.x = 0;
|
||||
refRectB.y = 0;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
||||
|
@ -743,7 +743,7 @@ int rect_testHasIntersectionOutside (void *arg)
|
|||
SDL_Rect rectB;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB fully outside of rectA
|
||||
/* rectB fully outside of rectA */
|
||||
refRectB.x = refRectA.x + refRectA.w + SDLTest_RandomIntegerInRange(1, 10);
|
||||
refRectB.y = refRectA.y + refRectA.h + SDLTest_RandomIntegerInRange(1, 10);
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -770,7 +770,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
|||
SDL_Rect rectB;
|
||||
SDL_bool intersection;
|
||||
|
||||
// rectB partially contained in rectA
|
||||
/* rectB partially contained in rectA */
|
||||
refRectB.x = SDLTest_RandomIntegerInRange(refRectA.x + 1, refRectA.x + refRectA.w - 1);
|
||||
refRectB.y = SDLTest_RandomIntegerInRange(refRectA.y + 1, refRectA.y + refRectA.h - 1);
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -780,7 +780,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// rectB right edge
|
||||
/* rectB right edge */
|
||||
refRectB.x = rectA.w - 1;
|
||||
refRectB.y = rectA.y;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -790,7 +790,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// rectB left edge
|
||||
/* rectB left edge */
|
||||
refRectB.x = 1 - rectA.w;
|
||||
refRectB.y = rectA.y;
|
||||
refRectB.w = refRectA.w;
|
||||
|
@ -800,7 +800,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// rectB bottom edge
|
||||
/* rectB bottom edge */
|
||||
refRectB.x = rectA.x;
|
||||
refRectB.y = rectA.h - 1;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -810,7 +810,7 @@ int rect_testHasIntersectionPartial (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// rectB top edge
|
||||
/* rectB top edge */
|
||||
refRectB.x = rectA.x;
|
||||
refRectB.y = 1 - rectA.h;
|
||||
refRectB.w = SDLTest_RandomIntegerInRange(1, refRectA.w - 1);
|
||||
|
@ -838,7 +838,7 @@ int rect_testHasIntersectionPoint (void *arg)
|
|||
SDL_bool intersection;
|
||||
int offsetX, offsetY;
|
||||
|
||||
// intersecting pixels
|
||||
/* intersecting pixels */
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectB.x = refRectA.x;
|
||||
|
@ -848,7 +848,7 @@ int rect_testHasIntersectionPoint (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_TRUE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// non-intersecting pixels cases
|
||||
/* non-intersecting pixels cases */
|
||||
for (offsetX = -1; offsetX <= 1; offsetX++) {
|
||||
for (offsetY = -1; offsetY <= 1; offsetY++) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
|
@ -883,7 +883,7 @@ int rect_testHasIntersectionEmpty (void *arg)
|
|||
SDL_Rect rectB;
|
||||
SDL_bool intersection;
|
||||
|
||||
// Rect A empty
|
||||
/* Rect A empty */
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -896,7 +896,7 @@ int rect_testHasIntersectionEmpty (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// Rect B empty
|
||||
/* Rect B empty */
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -909,7 +909,7 @@ int rect_testHasIntersectionEmpty (void *arg)
|
|||
intersection = SDL_HasIntersection(&rectA, &rectB);
|
||||
_validateHasIntersectionResults(intersection, SDL_FALSE, &rectA, &rectB, &refRectA, &refRectB);
|
||||
|
||||
// Rect A and B empty
|
||||
/* Rect A and B empty */
|
||||
refRectA.x = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.y = SDLTest_RandomIntegerInRange(1, 100);
|
||||
refRectA.w = SDLTest_RandomIntegerInRange(1, 100);
|
||||
|
@ -939,7 +939,7 @@ int rect_testHasIntersectionParam(void *arg)
|
|||
SDL_Rect rectB;
|
||||
SDL_bool intersection;
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
intersection = SDL_HasIntersection((SDL_Rect *)NULL, &rectB);
|
||||
SDLTest_AssertCheck(intersection == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
||||
intersection = SDL_HasIntersection(&rectA, (SDL_Rect *)NULL);
|
||||
|
@ -969,7 +969,7 @@ int rect_testEnclosePoints(void *arg)
|
|||
int minx = 0, maxx = 0, miny = 0, maxy = 0;
|
||||
int i;
|
||||
|
||||
// Create input data, tracking result
|
||||
/* Create input data, tracking result */
|
||||
for (i=0; i<numPoints; i++) {
|
||||
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
|
@ -990,7 +990,7 @@ int rect_testEnclosePoints(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
// Call function and validate - special case: no result requested
|
||||
/* Call function and validate - special case: no result requested */
|
||||
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
||||
"Check expected return value %s, got %s",
|
||||
|
@ -1002,7 +1002,7 @@ int rect_testEnclosePoints(void *arg)
|
|||
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
||||
}
|
||||
|
||||
// Call function and validate
|
||||
/* Call function and validate */
|
||||
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
||||
"Check return value %s, got %s",
|
||||
|
@ -1040,7 +1040,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
|
|||
int minx = 0, maxx = 0, miny = 0, maxy = 0;
|
||||
int i;
|
||||
|
||||
// Create input data, tracking result
|
||||
/* Create input data, tracking result */
|
||||
for (i=0; i<numPoints; i++) {
|
||||
if (i < halfPoints) {
|
||||
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
|
@ -1066,7 +1066,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
// Call function and validate - special case: no result requested
|
||||
/* Call function and validate - special case: no result requested */
|
||||
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, (SDL_Rect *)NULL);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
||||
"Check return value %s, got %s",
|
||||
|
@ -1078,7 +1078,7 @@ int rect_testEnclosePointsRepeatedInput(void *arg)
|
|||
i, refPoints[i].x, refPoints[i].y, points[i].x, points[i].y);
|
||||
}
|
||||
|
||||
// Call function and validate
|
||||
/* Call function and validate */
|
||||
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)NULL, &result);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
||||
"Check return value %s, got %s",
|
||||
|
@ -1117,13 +1117,13 @@ int rect_testEnclosePointsWithClipping(void *arg)
|
|||
int minx = 0, maxx = 0, miny = 0, maxy = 0;
|
||||
int i;
|
||||
|
||||
// Setup clipping rectangle
|
||||
/* Setup clipping rectangle */
|
||||
refClip.x = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refClip.y = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refClip.w = SDLTest_RandomIntegerInRange(1, 1024);
|
||||
refClip.h = SDLTest_RandomIntegerInRange(1, 1024);
|
||||
|
||||
// Create input data, tracking result
|
||||
/* Create input data, tracking result */
|
||||
for (i=0; i<numPoints; i++) {
|
||||
newx = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
newy = SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
|
@ -1148,7 +1148,7 @@ int rect_testEnclosePointsWithClipping(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
// Call function and validate - special case: no result requested
|
||||
/* Call function and validate - special case: no result requested */
|
||||
clip = refClip;
|
||||
anyEnclosedNoResult = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, (SDL_Rect *)NULL);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosedNoResult,
|
||||
|
@ -1163,7 +1163,7 @@ int rect_testEnclosePointsWithClipping(void *arg)
|
|||
SDLTest_AssertCheck(refClip.x==clip.x && refClip.y==clip.y && refClip.w==clip.w && refClip.h==clip.h,
|
||||
"Check that source clipping rectangle was not modified");
|
||||
|
||||
// Call function and validate
|
||||
/* Call function and validate */
|
||||
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, numPoints, (const SDL_Rect *)&clip, &result);
|
||||
SDLTest_AssertCheck(expectedEnclosed==anyEnclosed,
|
||||
"Check return value %s, got %s",
|
||||
|
@ -1209,7 +1209,7 @@ int rect_testEnclosePointsParam(void *arg)
|
|||
SDL_Rect result;
|
||||
SDL_bool anyEnclosed;
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
anyEnclosed = SDL_EnclosePoints((SDL_Point *)NULL, 1, (const SDL_Rect *)&clip, &result);
|
||||
SDLTest_AssertCheck(anyEnclosed == SDL_FALSE, "Check that functions returns SDL_FALSE when 1st parameter is NULL");
|
||||
anyEnclosed = SDL_EnclosePoints((const SDL_Point *)points, 0, (const SDL_Rect *)&clip, &result);
|
||||
|
@ -1434,7 +1434,7 @@ int rect_testUnionRectParam(void *arg)
|
|||
SDL_Rect rectA, rectB;
|
||||
SDL_Rect result;
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
SDL_UnionRect((SDL_Rect *)NULL, &rectB, &result);
|
||||
SDLTest_AssertPass("Check that function returns when 1st parameter is NULL");
|
||||
SDL_UnionRect(&rectA, (SDL_Rect *)NULL, &result);
|
||||
|
@ -1465,7 +1465,7 @@ int rect_testRectEmpty(void *arg)
|
|||
SDL_bool result;
|
||||
int w, h;
|
||||
|
||||
// Non-empty case
|
||||
/* Non-empty case */
|
||||
refRect.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refRect.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refRect.w=SDLTest_RandomIntegerInRange(256, 1024);
|
||||
|
@ -1475,7 +1475,7 @@ int rect_testRectEmpty(void *arg)
|
|||
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)&rect);
|
||||
_validateRectEmptyResults(result, expectedResult, &rect, &refRect);
|
||||
|
||||
// Empty case
|
||||
/* Empty case */
|
||||
for (w=-1; w<2; w++) {
|
||||
for (h=-1; h<2; h++) {
|
||||
if ((w != 1) || (h != 1)) {
|
||||
|
@ -1504,7 +1504,7 @@ int rect_testRectEmptyParam(void *arg)
|
|||
{
|
||||
SDL_bool result;
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
result = (SDL_bool)SDL_RectEmpty((const SDL_Rect *)NULL);
|
||||
SDLTest_AssertCheck(result == SDL_TRUE, "Check that function returns TRUE when 1st parameter is NULL");
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ int rect_testRectEquals(void *arg)
|
|||
SDL_bool expectedResult;
|
||||
SDL_bool result;
|
||||
|
||||
// Equals
|
||||
/* Equals */
|
||||
refRectA.x=SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refRectA.y=SDLTest_RandomIntegerInRange(-1024, 1024);
|
||||
refRectA.w=SDLTest_RandomIntegerInRange(1, 1024);
|
||||
|
@ -1563,7 +1563,7 @@ int rect_testRectEqualsParam(void *arg)
|
|||
rectB.w=SDLTest_RandomIntegerInRange(1, 1024);
|
||||
rectB.h=SDLTest_RandomIntegerInRange(1, 1024);
|
||||
|
||||
// invalid parameter combinations
|
||||
/* invalid parameter combinations */
|
||||
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)NULL, (const SDL_Rect *)&rectB);
|
||||
SDLTest_AssertCheck(result == SDL_FALSE, "Check that function returns SDL_FALSE when 1st parameter is NULL");
|
||||
result = (SDL_bool)SDL_RectEquals((const SDL_Rect *)&rectA, (const SDL_Rect *)NULL);
|
||||
|
|
|
@ -305,7 +305,7 @@ rwops_testFileRead(void)
|
|||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
|
||||
|
||||
// Bail out if NULL
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) return TEST_ABORTED;
|
||||
|
||||
/* Check type */
|
||||
|
@ -352,7 +352,7 @@ rwops_testFileWrite(void)
|
|||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
|
||||
|
||||
// Bail out if NULL
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) return TEST_ABORTED;
|
||||
|
||||
/* Check type */
|
||||
|
@ -642,7 +642,7 @@ rwops_testFileWriteReadEndian(void)
|
|||
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\")");
|
||||
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
|
||||
|
||||
// Bail out if NULL
|
||||
/* Bail out if NULL */
|
||||
if (rw == NULL) return TEST_ABORTED;
|
||||
|
||||
/* Write test data */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "SDL_test.h"
|
||||
|
||||
// Test collections
|
||||
/* Test collections */
|
||||
extern SDLTest_TestSuiteReference audioTestSuite;
|
||||
extern SDLTest_TestSuiteReference clipboardTestSuite;
|
||||
extern SDLTest_TestSuiteReference eventsTestSuite;
|
||||
|
@ -27,7 +27,7 @@ extern SDLTest_TestSuiteReference syswmTestSuite;
|
|||
extern SDLTest_TestSuiteReference timerTestSuite;
|
||||
extern SDLTest_TestSuiteReference videoTestSuite;
|
||||
|
||||
// All test suites
|
||||
/* All test suites */
|
||||
SDLTest_TestSuiteReference *testSuites[] = {
|
||||
&audioTestSuite,
|
||||
&clipboardTestSuite,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
/* sanity tests on SDL_rwops.c (usefull for alternative implementations of stdio rwops) */
|
||||
|
||||
// quiet windows compiler warnings
|
||||
/* quiet windows compiler warnings */
|
||||
#define _CRT_NONSTDC_NO_WARNINGS
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#define BPP 4
|
||||
#define DEPTH 32
|
||||
|
||||
//MUST BE A POWER OF 2!
|
||||
/*MUST BE A POWER OF 2!*/
|
||||
#define EVENT_BUF_SIZE 256
|
||||
|
||||
|
||||
|
@ -102,9 +102,9 @@ void setpix(SDL_Surface *screen, float _x, float _y, unsigned int col)
|
|||
SDL_memcpy(&colour,pixmem32,screen->format->BytesPerPixel);
|
||||
|
||||
SDL_GetRGB(colour,screen->format,&r,&g,&b);
|
||||
//r = 0;g = 0; b = 0;
|
||||
/*r = 0;g = 0; b = 0;*/
|
||||
a = (float)((col>>24)&0xFF);
|
||||
if(a == 0) a = 0xFF; //Hack, to make things easier.
|
||||
if(a == 0) a = 0xFF; /*Hack, to make things easier.*/
|
||||
a /= 0xFF;
|
||||
r = (Uint8)(r*(1-a) + ((col>>16)&0xFF)*(a));
|
||||
g = (Uint8)(g*(1-a) + ((col>> 8)&0xFF)*(a));
|
||||
|
@ -127,7 +127,7 @@ void drawCircle(SDL_Surface* screen,float x,float y,float r,unsigned int c)
|
|||
float xr;
|
||||
for(ty = (float)-SDL_fabs(r);ty <= (float)SDL_fabs((int)r);ty++) {
|
||||
xr = (float)sqrt(r*r - ty*ty);
|
||||
if(r > 0) { //r > 0 ==> filled circle
|
||||
if(r > 0) { /*r > 0 ==> filled circle*/
|
||||
for(tx=-xr+.5f;tx<=xr-.5;tx++) {
|
||||
setpix(screen,x+tx,y+ty,c);
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ void DrawScreen(SDL_Surface* screen)
|
|||
setpix(screen,(float)x,(float)y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255);
|
||||
#endif
|
||||
|
||||
//draw Touch History
|
||||
/*draw Touch History*/
|
||||
for(i = eventWrite; i < eventWrite+EVENT_BUF_SIZE; ++i) {
|
||||
const SDL_Event *event = &events[i&(EVENT_BUF_SIZE-1)];
|
||||
float age = (float)(i - eventWrite) / EVENT_BUF_SIZE;
|
||||
|
@ -170,7 +170,7 @@ void DrawScreen(SDL_Surface* screen)
|
|||
x = event->tfinger.x;
|
||||
y = event->tfinger.y;
|
||||
|
||||
//draw the touch:
|
||||
/*draw the touch:*/
|
||||
c = colors[event->tfinger.fingerId%7];
|
||||
col = ((unsigned int)(c*(.1+.85))) | (unsigned int)(0xFF*age)<<24;
|
||||
|
||||
|
@ -210,7 +210,7 @@ int main(int argc, char* argv[])
|
|||
/* Enable standard application logging */
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
|
||||
//gesture variables
|
||||
/*gesture variables*/
|
||||
knob.r = .1f;
|
||||
knob.ang = 0;
|
||||
|
||||
|
@ -225,7 +225,7 @@ int main(int argc, char* argv[])
|
|||
while(!quitting) {
|
||||
while(SDL_PollEvent(&event))
|
||||
{
|
||||
//Record _all_ events
|
||||
/*Record _all_ events*/
|
||||
events[eventWrite & (EVENT_BUF_SIZE-1)] = event;
|
||||
eventWrite++;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ void _Redraw(SDL_Renderer * renderer) {
|
|||
markedRect.w = textRect.w - w;
|
||||
if (markedRect.w < 0)
|
||||
{
|
||||
// Stop text input because we cannot hold any more characters
|
||||
/* Stop text input because we cannot hold any more characters */
|
||||
SDL_StopTextInput();
|
||||
return;
|
||||
}
|
||||
|
@ -342,8 +342,8 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
SDL_Log("text inputed: %s\n", text);
|
||||
|
||||
// After text inputed, we can clear up markedText because it
|
||||
// is committed
|
||||
/* After text inputed, we can clear up markedText because it */
|
||||
/* is committed*/
|
||||
markedText[0] = 0;
|
||||
Redraw();
|
||||
break;
|
||||
|
|
|
@ -46,12 +46,12 @@ button_messagebox(void *eventNumber)
|
|||
|
||||
SDL_MessageBoxData data = {
|
||||
SDL_MESSAGEBOX_INFORMATION,
|
||||
NULL, // no parent window
|
||||
NULL, /* no parent window */
|
||||
"Custom MessageBox",
|
||||
"This is a custom messagebox",
|
||||
2,
|
||||
buttons,
|
||||
NULL // Default color scheme
|
||||
NULL /* Default color scheme */
|
||||
};
|
||||
|
||||
int button = -1;
|
||||
|
|
|
@ -127,7 +127,7 @@ Draw(DrawState *s)
|
|||
|
||||
/* Update the screen! */
|
||||
SDL_RenderPresent(s->renderer);
|
||||
//SDL_Delay(10);
|
||||
/*SDL_Delay(10);*/
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -107,12 +107,12 @@ main(int argc, char **argv)
|
|||
SDL_FreeWAV(data);
|
||||
SDL_Quit();
|
||||
return 8;
|
||||
} // if
|
||||
} /* if */
|
||||
|
||||
SDL_free(cvt.buf);
|
||||
SDL_FreeWAV(data);
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
} // main
|
||||
} /* main */
|
||||
|
||||
// end of resample_test.c ...
|
||||
/* end of resample_test.c ... */
|
||||
|
|
|
@ -332,19 +332,19 @@ SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord)
|
|||
}
|
||||
|
||||
/* A general OpenGL initialization function. Sets all of the initial parameters. */
|
||||
void InitGL(int Width, int Height) // We call this right after our OpenGL window is created.
|
||||
void InitGL(int Width, int Height) /* We call this right after our OpenGL window is created. */
|
||||
{
|
||||
GLdouble aspect;
|
||||
|
||||
glViewport(0, 0, Width, Height);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This Will Clear The Background Color To Black
|
||||
glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
|
||||
glDepthFunc(GL_LESS); // The Type Of Depth Test To Do
|
||||
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
|
||||
glShadeModel(GL_SMOOTH); // Enables Smooth Color Shading
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); /* This Will Clear The Background Color To Black */
|
||||
glClearDepth(1.0); /* Enables Clearing Of The Depth Buffer */
|
||||
glDepthFunc(GL_LESS); /* The Type Of Depth Test To Do */
|
||||
glEnable(GL_DEPTH_TEST); /* Enables Depth Testing */
|
||||
glShadeModel(GL_SMOOTH); /* Enables Smooth Color Shading */
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity(); // Reset The Projection Matrix
|
||||
glLoadIdentity(); /* Reset The Projection Matrix */
|
||||
|
||||
aspect = (GLdouble)Width / Height;
|
||||
glOrtho(-3.0, 3.0, -3.0 / aspect, 3.0 / aspect, 0.0, 1.0);
|
||||
|
@ -363,29 +363,29 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat * texcoord)
|
|||
MAXY
|
||||
};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
|
||||
glLoadIdentity(); // Reset The View
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* Clear The Screen And The Depth Buffer */
|
||||
glLoadIdentity(); /* Reset The View */
|
||||
|
||||
glTranslatef(-1.5f,0.0f,0.0f); // Move Left 1.5 Units
|
||||
glTranslatef(-1.5f,0.0f,0.0f); /* Move Left 1.5 Units */
|
||||
|
||||
// draw a triangle (in smooth coloring mode)
|
||||
glBegin(GL_POLYGON); // start drawing a polygon
|
||||
glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red
|
||||
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
|
||||
glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green
|
||||
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
|
||||
glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue
|
||||
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
|
||||
glEnd(); // we're done with the polygon (smooth color interpolation)
|
||||
/* draw a triangle (in smooth coloring mode) */
|
||||
glBegin(GL_POLYGON); /* start drawing a polygon */
|
||||
glColor3f(1.0f,0.0f,0.0f); /* Set The Color To Red */
|
||||
glVertex3f( 0.0f, 1.0f, 0.0f); /* Top */
|
||||
glColor3f(0.0f,1.0f,0.0f); /* Set The Color To Green */
|
||||
glVertex3f( 1.0f,-1.0f, 0.0f); /* Bottom Right */
|
||||
glColor3f(0.0f,0.0f,1.0f); /* Set The Color To Blue */
|
||||
glVertex3f(-1.0f,-1.0f, 0.0f); /* Bottom Left */
|
||||
glEnd(); /* we're done with the polygon (smooth color interpolation) */
|
||||
|
||||
glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
|
||||
glTranslatef(3.0f,0.0f,0.0f); /* Move Right 3 Units */
|
||||
|
||||
// Enable blending
|
||||
/* Enable blending */
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
// draw a textured square (quadrilateral)
|
||||
/* draw a textured square (quadrilateral) */
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glColor3f(1.0f,1.0f,1.0f);
|
||||
|
@ -393,23 +393,23 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat * texcoord)
|
|||
glUseProgramObjectARB(shaders[current_shader].program);
|
||||
}
|
||||
|
||||
glBegin(GL_QUADS); // start drawing a polygon (4 sided)
|
||||
glBegin(GL_QUADS); /* start drawing a polygon (4 sided) */
|
||||
glTexCoord2f(texcoord[MINX], texcoord[MINY]);
|
||||
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
|
||||
glVertex3f(-1.0f, 1.0f, 0.0f); /* Top Left */
|
||||
glTexCoord2f(texcoord[MAXX], texcoord[MINY]);
|
||||
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
|
||||
glVertex3f( 1.0f, 1.0f, 0.0f); /* Top Right */
|
||||
glTexCoord2f(texcoord[MAXX], texcoord[MAXY]);
|
||||
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
|
||||
glVertex3f( 1.0f,-1.0f, 0.0f); /* Bottom Right */
|
||||
glTexCoord2f(texcoord[MINX], texcoord[MAXY]);
|
||||
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
|
||||
glEnd(); // done with the polygon
|
||||
glVertex3f(-1.0f,-1.0f, 0.0f); /* Bottom Left */
|
||||
glEnd(); /* done with the polygon */
|
||||
|
||||
if (shaders_supported) {
|
||||
glUseProgramObjectARB(0);
|
||||
}
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
// swap buffers to display, since we're double buffered.
|
||||
/* swap buffers to display, since we're double buffered. */
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ typedef struct LoadedPicture {
|
|||
|
||||
void render(SDL_Renderer *renderer,SDL_Texture *texture,SDL_Rect texture_dimensions)
|
||||
{
|
||||
//Clear render-target to blue.
|
||||
/*Clear render-target to blue.*/
|
||||
SDL_SetRenderDrawColor(renderer,0x00,0x00,0xff,0xff);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
//Render the texture.
|
||||
/*Render the texture.*/
|
||||
SDL_RenderCopy(renderer,texture,&texture_dimensions,&texture_dimensions);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
@ -188,17 +188,17 @@ int main(int argc,char** argv)
|
|||
next_time += TICK_INTERVAL;
|
||||
}
|
||||
|
||||
//Free the textures.
|
||||
/*Free the textures.*/
|
||||
for(i=0;i<num_pictures;i++)
|
||||
SDL_DestroyTexture(pictures[i].texture);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
//Destroy the window.
|
||||
/*Destroy the window.*/
|
||||
SDL_DestroyWindow(window);
|
||||
//Free the original surfaces backing the textures.
|
||||
/*Free the original surfaces backing the textures.*/
|
||||
for(i=0;i<num_pictures;i++)
|
||||
SDL_FreeSurface(pictures[i].surface);
|
||||
SDL_free(pictures);
|
||||
//Call SDL_VideoQuit() before quitting.
|
||||
/*Call SDL_VideoQuit() before quitting.*/
|
||||
SDL_VideoQuit();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -132,7 +132,7 @@ main(int argc, char *argv[])
|
|||
SDL_FreeCursor(cursor);
|
||||
|
||||
quit(0);
|
||||
// keep the compiler happy ...
|
||||
/* keep the compiler happy ... */
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue