From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_mouse_8cpp_source.html | 309 +++++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 Doc/doxygen/html/_mouse_8cpp_source.html (limited to 'Doc/doxygen/html/_mouse_8cpp_source.html') diff --git a/Doc/doxygen/html/_mouse_8cpp_source.html b/Doc/doxygen/html/_mouse_8cpp_source.html new file mode 100644 index 0000000..7b62f80 --- /dev/null +++ b/Doc/doxygen/html/_mouse_8cpp_source.html @@ -0,0 +1,309 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/nGenEx/Mouse.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
Mouse.cpp
+
+
+Go to the documentation of this file.
1 /* Project nGenEx
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: nGenEx.lib
+
6  FILE: Mouse.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Mouse class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "Mouse.h"
+
17 #include "DataLoader.h"
+
18 #include "Window.h"
+
19 #include "Screen.h"
+
20 #include "Bitmap.h"
+
21 #include "Video.h"
+
22 
+
23 // +--------------------------------------------------------------------+
+
24 
+
25 int Mouse::show = 1;
+
26 int Mouse::cursor = Mouse::ARROW;
+
27 
+
28 int Mouse::x = 320;
+
29 int Mouse::y = 240;
+
30 int Mouse::l = 0;
+
31 int Mouse::m = 0;
+
32 int Mouse::r = 0;
+
33 int Mouse::w = 0;
+
34 
+
35 Bitmap* Mouse::image[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
36 int Mouse::hotspot[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+
37 Window* Mouse::window = 0;
+
38 
+
39 // +--------------------------------------------------------------------+
+
40 
+
41 void Mouse::Create(Screen* screen)
+
42 {
+
43  if (screen) {
+
44  delete window;
+
45  window = new(__FILE__,__LINE__) Window(screen, 0, 0, screen->Width(), screen->Height());
+
46  }
+
47 }
+
48 
+
49 // +--------------------------------------------------------------------+
+
50 
+
51 void Mouse::Resize(Screen* screen)
+
52 {
+
53  if (screen) {
+
54  delete window;
+
55  window = new(__FILE__,__LINE__) Window(screen, 0, 0, screen->Width(), screen->Height());
+
56  }
+
57 }
+
58 
+
59 // +--------------------------------------------------------------------+
+
60 
+ +
62 {
+
63  for (int i = 0; i < 8; i++) {
+
64  delete image[i];
+
65  image[i] = 0;
+
66  }
+
67 
+
68  delete window;
+
69  window = 0;
+
70 
+
71  show = 0;
+
72  cursor = ARROW;
+
73 }
+
74 
+
75 // +--------------------------------------------------------------------+
+
76 
+
77 void
+
78 Mouse::SetCursorPos(int ax, int ay)
+
79 {
+
80  POINT p;
+
81  int dx = 0;
+
82  int dy = 0;
+
83 
+
84  ::GetCursorPos(&p);
+
85 
+
86  dx = p.x - x;
+
87  dy = p.y - y;
+
88 
+
89  x = ax;
+
90  y = ay;
+
91 
+
92  ::SetCursorPos(x+dx,y+dy);
+
93 }
+
94 
+
95 // +--------------------------------------------------------------------+
+
96 
+
97 int
+ +
99 {
+
100  int old = cursor;
+
101  cursor = c;
+
102  return old;
+
103 }
+
104 
+
105 // +--------------------------------------------------------------------+
+
106 
+
107 int
+
108 Mouse::LoadCursor(CURSOR c, const char* name, HOTSPOT hs)
+
109 {
+
110  int result = 0;
+
111 
+
112  delete image[c];
+
113  image[c] = 0;
+
114 
+
115  if (name && *name) {
+
116  image[c] = new(__FILE__,__LINE__) Bitmap;
+
117  result = DataLoader::GetLoader()->LoadBitmap(name, *image[c], Bitmap::BMP_TRANSPARENT);
+
118 
+
119  if (result) {
+
120  Bitmap* bmp = image[c];
+
121 
+
122  if (bmp && bmp->HiPixels())
+
123  image[c]->CopyAlphaRedChannel(image[c]->Width(), image[c]->Height(), (LPDWORD) image[c]->HiPixels());
+
124 
+
125  hotspot[c] = hs;
+
126  }
+
127  }
+
128 
+
129  return result;
+
130 }
+
131 
+
132 // +--------------------------------------------------------------------+
+
133 
+
134 void
+ +
136 {
+
137  show = s;
+
138 }
+
139 
+
140 // +--------------------------------------------------------------------+
+
141 
+
142 void
+ +
144 {
+
145  if (!show || !window) return;
+
146 
+
147  // draw using bitmap:
+
148  if (image[cursor]) {
+
149  int w2 = image[cursor]->Width()/2;
+
150  int h2 = image[cursor]->Height()/2;
+
151 
+
152  if (hotspot[cursor] == HOTSPOT_NW)
+
153  window->DrawBitmap(x, y, x+w2*2, y+h2*2, image[cursor], Video::BLEND_ALPHA);
+
154  else
+
155  window->DrawBitmap(x-w2, y-h2, x+w2, y+h2, image[cursor], Video::BLEND_ALPHA);
+
156  }
+
157 
+
158  // draw using primitives:
+
159  /***
+
160 else {
+
161  switch (cursor) {
+
162  case ARROW:
+
163  case CROSS:
+
164  case USER1:
+
165  case USER2:
+
166  case USER3:
+
167  default:
+
168  window->DrawLine(x-7, y, x+8, y, Color::White);
+
169  window->DrawLine(x, y-7, x, y+8, Color::White);
+
170  break;
+
171 
+
172  case WAIT:
+
173  window->DrawLine(x-7, y-7, x+8, y-7, Color::White);
+
174  window->DrawLine(x-7, y-7, x+8, y+8, Color::White);
+
175  window->DrawLine(x-7, y+8, x+8, y-7, Color::White);
+
176  window->DrawLine(x-7, y+8, x+8, y+8, Color::White);
+
177  break;
+
178 
+
179  case NOT:
+
180  window->DrawEllipse(x-7,y-7,x+8,y+8, Color::White);
+
181  window->DrawLine( x-7,y-7,x+8,y+8, Color::White);
+
182  break;
+
183 
+
184  case DRAG:
+
185  window->DrawRect(x-7, y-6, x+8, y-3, Color::White);
+
186  window->DrawRect(x-7, y-1, x+8, y+2, Color::White);
+
187  window->DrawRect(x-7, y+4, x+8, y+7, Color::White);
+
188  break;
+
189  }
+
190 }
+
191 ***/
+
192 }
+
+
+ + + + -- cgit v1.1