18 #include <Carbon/Carbon.h>
19 extern "C" {
void CPSEnableForegroundOperation(ProcessSerialNumber* psn); }
32 STICKYKEYS g_StartupStickyKeys = {
sizeof(STICKYKEYS), 0};
33 TOGGLEKEYS g_StartupToggleKeys = {
sizeof(TOGGLEKEYS), 0};
34 FILTERKEYS g_StartupFilterKeys = {
sizeof(FILTERKEYS), 0};
40 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_SHOWBASE)
41 #error Buildsystem error: BUILDING_DIRECT_SHOWBASE not defined
44 ConfigureDef(config_showbase);
45 ConfigureFn(config_showbase) {
50 PRC_DESC(
"The directories to search for particle files to be loaded."));
61 throw_event(
"NewFrame");
74 activate_osx_application();
96 static int num_fullscreen_testsizes = 0;
97 #define MAX_FULLSCREEN_TESTS 10
98 static int fullscreen_testsizes[MAX_FULLSCREEN_TESTS * 2];
101 add_fullscreen_testsize(
int xsize,
int ysize) {
102 if ((xsize == 0) && (ysize == 0)) {
103 num_fullscreen_testsizes = 0;
108 if (num_fullscreen_testsizes < MAX_FULLSCREEN_TESTS) {
109 fullscreen_testsizes[num_fullscreen_testsizes * 2] = xsize;
110 fullscreen_testsizes[num_fullscreen_testsizes * 2 + 1] = ysize;
111 num_fullscreen_testsizes++;
121 query_fullscreen_testresult(
int xsize,
int ysize) {
124 for (i=0; i < num_fullscreen_testsizes; i++) {
125 if((fullscreen_testsizes[i * 2] == xsize) &&
126 (fullscreen_testsizes[i * 2 + 1] == ysize))
133 store_accessibility_shortcut_keys() {
135 SystemParametersInfo(SPI_GETSTICKYKEYS,
sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
136 SystemParametersInfo(SPI_GETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
137 SystemParametersInfo(SPI_GETFILTERKEYS,
sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
142 allow_accessibility_shortcut_keys(
bool allowKeys) {
147 SystemParametersInfo(SPI_SETSTICKYKEYS,
sizeof(STICKYKEYS), &g_StartupStickyKeys, 0);
148 SystemParametersInfo(SPI_SETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &g_StartupToggleKeys, 0);
149 SystemParametersInfo(SPI_SETFILTERKEYS,
sizeof(FILTERKEYS), &g_StartupFilterKeys, 0);
154 STICKYKEYS skOff = g_StartupStickyKeys;
155 if( (skOff.dwFlags & SKF_STICKYKEYSON) == 0 )
158 skOff.dwFlags &= ~SKF_HOTKEYACTIVE;
159 skOff.dwFlags &= ~SKF_CONFIRMHOTKEY;
161 SystemParametersInfo(SPI_SETSTICKYKEYS,
sizeof(STICKYKEYS), &skOff, 0);
164 TOGGLEKEYS tkOff = g_StartupToggleKeys;
165 if( (tkOff.dwFlags & TKF_TOGGLEKEYSON) == 0 )
168 tkOff.dwFlags &= ~TKF_HOTKEYACTIVE;
169 tkOff.dwFlags &= ~TKF_CONFIRMHOTKEY;
171 SystemParametersInfo(SPI_SETTOGGLEKEYS,
sizeof(TOGGLEKEYS), &tkOff, 0);
174 FILTERKEYS fkOff = g_StartupFilterKeys;
175 if( (fkOff.dwFlags & FKF_FILTERKEYSON) == 0 )
178 fkOff.dwFlags &= ~FKF_HOTKEYACTIVE;
179 fkOff.dwFlags &= ~FKF_CONFIRMHOTKEY;
181 SystemParametersInfo(SPI_SETFILTERKEYS,
sizeof(FILTERKEYS), &fkOff, 0);
188 int TempGridZoneManager::
189 add_grid_zone(
unsigned int x,
193 unsigned int zoneBase,
194 unsigned int xZoneResolution,
195 unsigned int yZoneResolution) {
199 std::cerr<<
"adding grid zone with a zoneBase of "<<zoneBase<<
" and a zoneResolution of "<<zoneResolution;
200 _grids.append(TempGridZoneManager::GridZone(x, y, width, height, zoneBase, xZoneResolution, yZoneResolution));
201 return zoneBase+xZoneResolution*yZoneResolution;
204 void TempGridZoneManager::GridZone
205 GridZone(
unsigned int x,
209 unsigned int zoneBase,
210 unsigned int xZoneResolution,
211 unsigned int yZoneResolution) {
217 _xZoneResolution=xZoneResolution;
218 _yZoneResolution=yZoneResolution;
222 const float cellVis=3.0;
223 unsigned int xMargine=(
unsigned int)((
float)width/(float)xZoneResolution*cellVis+0.5);
224 unsigned int yMargine=(
unsigned int)((
float)height/(float)yZoneResolution*cellVis+0.5);
227 _xMaxVis=x+width+xMargine;
228 _yMaxVis=y+height+yMargine;
231 void TempGridZoneManager::
232 get_grids(
int x,
int y) {
233 TempGridZoneManager::ZoneSet canSee;
234 TempGridZoneManager::GridSet::const_iterator i=_grids.begin();
235 for (; i!=_grids.end(); ++i) {
236 if (x >= i._xMinVis && x < i._xMaxVis && y >= i._yMinVis && y < i._yMaxVis) {
237 add_to_zone_list(i, x, y, canSee);
242 void TempGridZoneManager::
243 add_to_zone_list(
const TempGridZoneManager::GridZone &gridZone,
246 TempGridZoneManager::ZoneSet &zoneSet) {
247 unsigned int xRes=gridZone._xZoneResolution;
248 unsigned int yRes=gridZone._yZoneResolution;
249 float xP=((float)(x-gridZone._x))/gridZone._width;
250 float yP=((
float)(y-gridZone._y))/gridZone._height;
251 int xCell=(int)(xP*xRes);
252 int yCell=(int)(yP*yRes);
256 int yBegin=max(0, yCell-range);
257 int yEnd=min(yRes, yCell+range);
258 int xBegin=max(0, xCell-range);
259 int xEnd=min(xRes, xCell+range);
260 unsigned int zone=gridZone._zoneBase+yBegin*xRes+xBegin;
262 for (yCell=yBegin; yCell < yEnd; ++yCell) {
263 for (xCell=xBegin; xCell < xEnd; ++xCell) {
264 zoneSet.append(zone+xCell);
270 int TempGridZoneManager::
271 get_zone_list(
int x,
int y,
int resolution) {
276 if (x < 0.0 || x > 1.0 || y < 0.0 || y > 1.0) {
279 std::cerr<<
"resolution="<<resolution;
280 xCell=min(
int(x*resolution), resolution-1)
281 yCell=min(
int(y*resolution), resolution-1)
282 cell=yCell*resolution+xCell
287 zone=zone-2*resolution
288 endZone=zone+5*resolution
290 while zone < endZone:
291 if yCell >= 0 and yCell < resolution:
293 zoneList.append(zone-2)
294 zoneList.append(zone-1)
296 zoneList.append(zone-1)
298 if xCell < resolution-2:
299 zoneList.append(zone+1)
300 zoneList.append(zone+2)
301 elif xCell < resolution-1:
302 zoneList.append(zone+1)
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is similar to a ConfigVariableList, but it returns its list as a DSearchPath,...
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.