Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
android.cpp
Go to the documentation of this file.
1 /* Copyright (c) 2012 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #include "precompiled.h"
24 
25 #include "lib/sysdep/sysdep.h"
26 #include "lib/sysdep/cursor.h"
27 
29 
30 Status sys_clipboard_set(const wchar_t* UNUSED(text))
31 {
32  return INFO::OK;
33 }
34 
36 {
37  return NULL;
38 }
39 
41 {
42  return INFO::OK;
43 }
44 
45 namespace gfx {
46 
47 Status GetVideoMode(int* xres, int* yres, int* bpp, int* freq)
48 {
49 #warning TODO: implement gfx::GetVideoMode properly for Android
50 
51  if(xres)
52  *xres = 800;
53 
54  if(yres)
55  *yres = 480;
56 
57  if(bpp)
58  *bpp = 32;
59 
60  if(freq)
61  *freq = 0;
62 
63  return INFO::OK;
64 }
65 
66 }
67 
68 // stub implementation of sys_cursor* functions
69 
70 // note: do not return ERR_NOT_IMPLEMENTED or similar because that
71 // would result in WARN_ERRs.
72 Status sys_cursor_create(int w, int h, void* bgra_img, int hx, int hy, sys_cursor* cursor)
73 {
74  UNUSED2(w);
75  UNUSED2(h);
76  UNUSED2(hx);
77  UNUSED2(hy);
78  UNUSED2(bgra_img);
79 
80  *cursor = 0;
81  return INFO::OK;
82 }
83 
84 // returns a dummy value representing an empty cursor
86 {
87  *cursor = (void*)1; // any non-zero value, since the cursor NULL has special meaning
88  return INFO::OK;
89 }
90 
91 // replaces the current system cursor with the one indicated. need only be
92 // called once per cursor; pass 0 to restore the default.
94 {
95  if (cursor) // dummy empty cursor
97  else // restore default cursor
99 
100  return INFO::OK;
101 }
102 
103 // destroys the indicated cursor and frees its resources. if it is
104 // currently the system cursor, the default cursor is restored first.
106 {
107  // bail now to prevent potential confusion below; there's nothing to do.
108  if(!cursor)
109  return INFO::OK;
110 
112 
113  return INFO::OK;
114 }
115 
117 {
118  return INFO::OK;
119 }
120 
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
int SDL_ShowCursor(int toggle)
Definition: wsdl.cpp:1106
const Status OK
Definition: status.h:386
Status sys_clipboard_set(const wchar_t *text)
Definition: android.cpp:30
void * sys_cursor
Definition: cursor.h:30
Status sys_cursor_create(int w, int h, void *bgra_img, int hx, int hy, sys_cursor *cursor)
Create a cursor from the given color image.
Definition: android.cpp:72
Status sys_cursor_reset()
reset any cached cursor data.
Definition: android.cpp:116
LIB_API Status GetVideoMode(int *xres, int *yres, int *bpp, int *freq)
(useful for choosing a new video mode)
Definition: android.cpp:47
Status sys_clipboard_free(wchar_t *copy)
Definition: android.cpp:40
Status sys_cursor_create_empty(sys_cursor *cursor)
Create a transparent cursor (used to hide the system cursor).
Definition: android.cpp:85
#define UNUSED2(param)
mark a function local variable or parameter as unused and avoid the corresponding compiler warning...
i64 Status
Error handling system.
Definition: status.h:171
wchar_t * sys_clipboard_get()
Definition: android.cpp:35
Status sys_cursor_set(sys_cursor cursor)
override the current system cursor.
Definition: android.cpp:93
Status sys_cursor_free(sys_cursor cursor)
destroy the indicated cursor and frees its resources.
Definition: android.cpp:105