2
* OpenTyrian: A modern cross-platform port of Tyrian
3
* Copyright (C) 2007-2009 The OpenTyrian Development Team
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#if defined(TARGET_GP2X) || defined(TARGET_DINGUX)
26
bool has_mouse = false;
28
bool has_mouse = true;
30
bool mouse_has_three_buttons = true;
32
JE_word lastMouseX, lastMouseY;
34
JE_word mouseX, mouseY, mouseButton;
35
JE_word mouseXB, mouseYB;
37
JE_byte mouseGrabShape[24 * 28]; /* [1..24*28] */
39
void JE_drawShapeTypeOne( JE_word x, JE_word y, JE_byte *shape )
41
JE_word xloop = 0, yloop = 0;
42
JE_byte *p = shape; /* shape pointer */
43
Uint8 *s; /* screen pointer, 8-bit specific */
44
Uint8 *s_limit; /* buffer boundary */
46
s = (Uint8 *)VGAScreen->pixels;
47
s += y * VGAScreen->pitch + x;
49
s_limit = (Uint8 *)VGAScreen->pixels;
50
s_limit += VGAScreen->h * VGAScreen->pitch;
52
for (yloop = 0; yloop < 28; yloop++)
54
for (xloop = 0; xloop < 24; xloop++)
56
if (s >= s_limit) return;
61
s += VGAScreen->pitch;
65
void JE_grabShapeTypeOne( JE_word x, JE_word y, JE_byte *shape )
67
JE_word xloop = 0, yloop = 0;
68
JE_byte *p = shape; /* shape pointer */
69
Uint8 *s; /* screen pointer, 8-bit specific */
70
Uint8 *s_limit; /* buffer boundary */
72
s = (Uint8 *)VGAScreen->pixels;
73
s += y * VGAScreen->pitch + x;
75
s_limit = (Uint8 *)VGAScreen->pixels;
76
s_limit += VGAScreen->h * VGAScreen->pitch;
78
for (yloop = 0; yloop < 28; yloop++)
80
for (xloop = 0; xloop < 24; xloop++)
82
if (s >= s_limit) return;
87
s += VGAScreen->pitch;
91
void JE_mouseStart( void )
93
const JE_word mouseCursorGr[3] /* [1..3] */ = {273, 275, 277};
97
service_SDL_events(false);
98
mouseButton = mousedown ? lastmouse_but : 0; /* incorrect, possibly unimportant */
99
lastMouseX = MIN(mouse_x, 320 - 13);
100
lastMouseY = MIN(mouse_y, 200 - 16);
102
JE_grabShapeTypeOne(lastMouseX, lastMouseY, mouseGrabShape);
104
blit_sprite2x2(VGAScreen, lastMouseX, lastMouseY, shapes6, mouseCursorGr[mouseCursor]);
108
void JE_mouseReplace( void )
111
JE_drawShapeTypeOne(lastMouseX, lastMouseY, mouseGrabShape);