本文整理汇总了C++中WindowApplication类的典型用法代码示例。如果您正苦于以下问题:C++ WindowApplication类的具体用法?C++ WindowApplication怎么用?C++ WindowApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WindowApplication类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ProcessKeyModifierChanged
//----------------------------------------------------------------------------
static pascal OSStatus ProcessKeyModifierChanged (EventHandlerCallRef,
EventRef evt, void*)
{
static UInt32 sLastState = 0;
UInt32 currState;
GetEventParameter(evt, kEventParamKeyModifiers, typeUInt32, 0,
sizeof(currState), 0, &currState);
currState &= 0x0000FFFF;
if (currState != sLastState)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
CGrafPtr currPort;
GetPort(&currPort);
SetPortWindowPort((WindowRef)(theApp->GetWindowID()));
Point mouseLoc;
GetMouse(&mouseLoc);
SetPort(currPort);
ProcessModifier(theApp, shiftKey, mouseLoc, currState, sLastState);
ProcessModifier(theApp, controlKey, mouseLoc, currState, sLastState);
ProcessModifier(theApp, optionKey, mouseLoc, currState, sLastState);
ProcessModifier(theApp, cmdKey, mouseLoc, currState, sLastState);
sLastState = currState;
}
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:34,代码来源:Wm5AglApplication.cpp
示例2: while
void WindowManager::Render()
{
list<WindowApplication*>::reverse_iterator windowIt = _windows.rbegin();
list<WindowApplication*>::reverse_iterator finalWindow = _windows.rend();
WindowApplication* ontop = 0;
while (windowIt != finalWindow)
{
WindowApplication* window = (WindowApplication*)*windowIt;
if (window->Settings->Enabled == 1)
{
window->Render();
if (window->Settings->Fullscreen)
{
window->RenderFullscreen();
FullScreenEnabled = 1;
break;
}
if (window->Settings->OnTop == 1)
ontop = window;
else
RenderWindow(window);
}
windowIt++;
}
if (ontop)
RenderWindow(ontop);
ontop = 0;
}
开发者ID:rpheuts,项目名称:artillery,代码行数:29,代码来源:WindowManager.cpp
示例3: ProcessMouseDragged
//----------------------------------------------------------------------------
static pascal OSStatus ProcessMouseDragged (EventHandlerCallRef, EventRef evt,
void*)
{
Point mouseLoc;
GetEventParameter(evt, kEventParamMouseLocation, typeQDPoint, 0,
sizeof(mouseLoc), 0, &mouseLoc);
EventMouseButton mouseButton;
GetEventParameter(evt, kEventParamMouseButton, typeMouseButton, 0,
sizeof(mouseButton), 0, &mouseButton);
UInt32 modifiers;
GetEventParameter(evt, kEventParamKeyModifiers, typeUInt32, 0,
sizeof(modifiers), 0, &modifiers);
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
CGrafPtr currPort;
GetPort(&currPort);
SetPortWindowPort((WindowRef)(theApp->GetWindowID()));
GlobalToLocal(&mouseLoc);
SetPort(currPort);
theApp->OnMotion(mouseButton, mouseLoc.h, mouseLoc.v, modifiers);
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:30,代码来源:Wm5AglApplication.cpp
示例4: ProcessTimer
//----------------------------------------------------------------------------
static pascal void ProcessTimer (EventLoopTimerRef, void*)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
theApp->OnIdle();
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:8,代码来源:Wm5AglApplication.cpp
示例5: ProcessWindowBoundsChange
//----------------------------------------------------------------------------
static pascal OSStatus ProcessWindowBoundsChange (EventHandlerCallRef,
EventRef evt, void*)
{
UInt32 attributes;
GetEventParameter(evt, kEventParamAttributes, typeUInt32, 0,
sizeof(attributes), 0, &attributes);
Rect rect;
GetEventParameter(evt, kEventParamCurrentBounds, typeQDRectangle, 0,
sizeof(rect), 0, &rect);
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (attributes & kWindowBoundsChangeUserDrag
|| attributes & kWindowBoundsChangeOriginChanged)
{
// Bounds are changing due to window moving.
theApp->OnMove(rect.top, rect.left);
}
else if (attributes & kWindowBoundsChangeUserResize
|| attributes & kWindowBoundsChangeSizeChanged)
{
// Bounds are changing due to window resizing.
theApp->OnResize(rect.right - rect.left, rect.bottom - rect.top);
}
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:31,代码来源:Wm5AglApplication.cpp
示例6: PassiveMotionCallback
//----------------------------------------------------------------------------
static void PassiveMotionCallback (int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnPassiveMotion(x, y);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例7: MotionCallback
//----------------------------------------------------------------------------
static void MotionCallback (int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnMotion(gsButton, x, y, gsGLUTModifiers);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例8: SpecialKeyUpCallback
//----------------------------------------------------------------------------
static void SpecialKeyUpCallback (int key, int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnSpecialKeyUp(key, x, y);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例9: KeyUpCallback
//----------------------------------------------------------------------------
static void KeyUpCallback (unsigned char key, int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnKeyUp(key, x, y);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例10: IdleCallback
//----------------------------------------------------------------------------
static void IdleCallback ()
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnIdle();
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例11: DisplayCallback
//----------------------------------------------------------------------------
static void DisplayCallback ()
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnDisplay();
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:11,代码来源:Wm5GlutApplication.cpp
示例12: ReshapeCallback
//----------------------------------------------------------------------------
static void ReshapeCallback (int width, int height)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnResize(width, height);
theApp->OnDisplay();
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:12,代码来源:Wm5GlutApplication.cpp
示例13: ProcessWindowRedraw
//----------------------------------------------------------------------------
static pascal OSStatus ProcessWindowRedraw (EventHandlerCallRef, EventRef,
void*)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
theApp->OnDisplay();
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:12,代码来源:Wm5AglApplication.cpp
示例14: Terminate
//----------------------------------------------------------------------------
static void Terminate ()
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
theApp->OnTerminate();
glutDestroyWindow(theApp->GetWindowID());
Renderer* renderer = (Renderer*)theApp->GetRenderer();
delete0(renderer);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:14,代码来源:Wm5GlutApplication.cpp
示例15: KeyDownCallback
//----------------------------------------------------------------------------
static void KeyDownCallback (unsigned char key, int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
if (theApp)
{
if (key == theApp->KEY_TERMINATE)
{
exit(0);
}
theApp->OnKeyDown(key, x, y);
}
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:16,代码来源:Wm5GlutApplication.cpp
示例16: GetMousePosition
//----------------------------------------------------------------------------
void WindowApplication::GetMousePosition (int& x, int& y) const
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
CGrafPtr currPort;
GetPort(&currPort);
SetPortWindowPort((WindowRef)(theApp->GetWindowID()));
Point mouseLoc;
GetMouse(&mouseLoc);
SetPort(currPort);
x = (int)mouseLoc.h;
y = (int)mouseLoc.v;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:16,代码来源:Wm5AglApplication.cpp
示例17: ProcessKeyDown
//----------------------------------------------------------------------------
static pascal OSStatus ProcessKeyDown (EventHandlerCallRef, EventRef evt,
void*)
{
char charCode;
GetEventParameter(evt, kEventParamKeyMacCharCodes, typeChar, 0,
sizeof(charCode), 0, &charCode);
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
CGrafPtr currPort;
GetPort(&currPort);
SetPortWindowPort((WindowRef)(theApp->GetWindowID()));
Point mouseLoc;
GetMouse(&mouseLoc);
SetPort(currPort);
if (charCode == kEscapeCharCode)
{
// Quit the application when 'esc' is pressed.
QuitApplicationEventLoop();
return eventNotHandledErr;
}
if (isalnum(charCode) || isprint(charCode))
{
theApp->OnKeyDown(charCode, mouseLoc.h, mouseLoc.v);
}
else
{
if (charCode == kFunctionKeyCharCode)
{
// Function key - get key identity.
UInt32 keyCode;
GetEventParameter(evt, kEventParamKeyCode, typeUInt32, 0,
sizeof(keyCode), 0, &keyCode);
charCode = keyCode & 0x000000FF;
}
// Do not filter for specific keys. This allows for keys such as tab,
// delete, enter.
theApp->OnSpecialKeyDown(charCode, mouseLoc.h, mouseLoc.v);
}
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:49,代码来源:Wm5AglApplication.cpp
示例18: SetMousePosition
//----------------------------------------------------------------------------
void WindowApplication::SetMousePosition (int x, int y)
{
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
CGrafPtr currPort;
GetPort(&currPort);
SetPortWindowPort((WindowRef)(theApp->GetWindowID()));
Point mouseLoc;
mouseLoc.h = (short)x;
mouseLoc.v = (short)y;
LocalToGlobal(&mouseLoc);
SetPort(currPort);
CGPoint point = CGPointMake((float)mouseLoc.h, (float)mouseLoc.v);
CGPostMouseEvent(point, true, 1, false, 0);
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:18,代码来源:Wm5AglApplication.cpp
示例19: ProcessWindowZoomed
//----------------------------------------------------------------------------
static pascal OSStatus ProcessWindowZoomed (EventHandlerCallRef,
EventRef evt, void*)
{
WindowRef window;
GetEventParameter(evt, kEventParamDirectObject, typeWindowRef, 0,
sizeof(window), 0, &window);
Rect rect;
GetWindowBounds(window, kWindowContentRgn, &rect);
WindowApplication* theApp =
(WindowApplication*)Application::TheApplication;
theApp->OnResize(rect.right - rect.left, rect.bottom - rect.top);
// Allow standard handler to run.
return eventNotHandledErr;
}
开发者ID:bazhenovc,项目名称:WildMagic,代码行数:19,代码来源:Wm5AglApplication.cpp
示例20: HandleController
void WindowManager::HandleController()
{
if (_windows.size() > 0)
{
WindowApplication* window = _windows.front();
if ((Interface::IsWithinWindowContent(_controller->CursorX, _controller->CursorY, window) || _isActive) && window->Settings->Enabled == 1)
{
if (!window->Settings->Fullscreen)
window->HandleController(_controller->CursorX - window->ContentX, _controller->CursorY - window->ContentY);
else
window->HandleController(_controller->CursorX, _controller->CursorY);
_controller->Handled = 1;
}
else
_isActive = 0;
}
}
开发者ID:rpheuts,项目名称:artillery,代码行数:18,代码来源:WindowManager.cpp
注:本文中的WindowApplication类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论