include/SDL_gesture.h
author Ryan C. Gordon <icculus@icculus.org>
Thu, 28 May 2015 01:54:52 -0400
changeset 9671 0e1f57b051f4
parent 9619 b94b6d0bff0f
child 9998 f67cf37e9cd4
permissions -rw-r--r--
Windows GetBasePath should use GetModuleFileNameExW() and check for overflows.

Apparently you might get strange paths from GetModuleFileName(), such as
short path names or UNC filenames, so this avoids that problem. Since you have
to tapdance with linking different libraries and defining macros depending on
what Windows you plan to target, we dynamically load the API we need, which
works on all versions of Windows (on Win7, it'll load a compatibility wrapper
for the newer API location).

What a mess.

This also now does the right thing if there isn't enough space to store the
path, looping with a larger allocated buffer each try.

Fixes Bugzilla #2435.
jim@4659
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@9619
     3
  Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
jim@4659
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
jim@4659
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
jim@4659
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
jim@4659
    20
*/
jim@4659
    21
jim@4659
    22
/**
jim@4659
    23
 *  \file SDL_gesture.h
slouken@7191
    24
 *
jim@4659
    25
 *  Include file for SDL gesture event handling.
jim@4659
    26
 */
jim@4659
    27
jim@4659
    28
#ifndef _SDL_gesture_h
jim@4659
    29
#define _SDL_gesture_h
jim@4659
    30
jim@4659
    31
#include "SDL_stdinc.h"
jim@4659
    32
#include "SDL_error.h"
jim@4659
    33
#include "SDL_video.h"
jim@4659
    34
jimtla@4678
    35
#include "SDL_touch.h"
jimtla@4678
    36
jimtla@4678
    37
jim@4659
    38
#include "begin_code.h"
jim@4659
    39
/* Set up for C function definitions, even when using C++ */
jim@4659
    40
#ifdef __cplusplus
jim@4659
    41
extern "C" {
jim@4659
    42
#endif
jim@4659
    43
slouken@4679
    44
typedef Sint64 SDL_GestureID;
jim@4659
    45
jim@4659
    46
/* Function prototypes */
jim@4659
    47
jim@4659
    48
/**
jim@4659
    49
 *  \brief Begin Recording a gesture on the specified touch, or all touches (-1)
jim@4659
    50
 *
jim@4659
    51
 *
jim@4659
    52
 */
slouken@4679
    53
extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
jim@4659
    54
jim@4659
    55
jim@4659
    56
/**
jim@4659
    57
 *  \brief Save all currently loaded Dollar Gesture templates
jim@4659
    58
 *
jim@4659
    59
 *
jim@4659
    60
 */
philipp@7900
    61
extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
jim@4659
    62
jim@4659
    63
/**
jim@4659
    64
 *  \brief Save a currently loaded Dollar Gesture template
jim@4659
    65
 *
jim@4659
    66
 *
jim@4659
    67
 */
philipp@7900
    68
extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *dst);
jim@4659
    69
jim@4659
    70
jim@4659
    71
/**
jim@4659
    72
 *  \brief Load Dollar Gesture templates from a file
jim@4659
    73
 *
jim@4659
    74
 *
jim@4659
    75
 */
slouken@4679
    76
extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src);
jim@4659
    77
jim@4659
    78
jim@4659
    79
/* Ends C function definitions when using C++ */
jim@4659
    80
#ifdef __cplusplus
jim@4659
    81
}
jim@4659
    82
#endif
jim@4659
    83
#include "close_code.h"
jim@4659
    84
jim@4659
    85
#endif /* _SDL_gesture_h */
jim@4659
    86
jim@4659
    87
/* vi: set ts=4 sw=4 expandtab: */