本文整理汇总了C++中Invalidate函数的典型用法代码示例。如果您正苦于以下问题:C++ Invalidate函数的具体用法?C++ Invalidate怎么用?C++ Invalidate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Invalidate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToggleFullScreen
//.........这里部分代码省略.........
int h;
int bpp;
unsigned char *pixels = NULL;
SDL_Color *palette = NULL;
int ncolors = 0;
if (!TheScreen) { // don't bother if there's no surface.
return;
}
flags = TheScreen->flags;
w = TheScreen->w;
h = TheScreen->h;
bpp = TheScreen->format->BitsPerPixel;
if (!SDL_VideoModeOK(w, h, bpp, flags ^ SDL_FULLSCREEN)) {
return;
}
SDL_GetClipRect(TheScreen, &clip);
// save the contents of the screen.
framesize = w * h * TheScreen->format->BytesPerPixel;
#if defined(USE_OPENGL) || defined(USE_GLES)
if (!UseOpenGL)
#endif
{
if (!(pixels = new unsigned char[framesize])) { // out of memory
return;
}
SDL_LockSurface(TheScreen);
memcpy(pixels, TheScreen->pixels, framesize);
if (TheScreen->format->palette) {
ncolors = TheScreen->format->palette->ncolors;
if (!(palette = new SDL_Color[ncolors])) {
delete[] pixels;
return;
}
memcpy(palette, TheScreen->format->palette->colors,
ncolors * sizeof(SDL_Color));
}
SDL_UnlockSurface(TheScreen);
}
TheScreen = SDL_SetVideoMode(w, h, bpp, flags ^ SDL_FULLSCREEN);
if (!TheScreen) {
TheScreen = SDL_SetVideoMode(w, h, bpp, flags);
if (!TheScreen) { // completely screwed.
#if defined(USE_OPENGL) || defined(USE_GLES)
if (!UseOpenGL)
#endif
{
delete[] pixels;
delete[] palette;
}
fprintf(stderr, "Toggle to fullscreen, crashed all\n");
Exit(-1);
}
}
#ifndef USE_TOUCHSCREEN
// Cannot hide cursor on Windows with touchscreen, as it switches
// to relative mouse coordinates in fullscreen. See above initial
// call to ShowCursor
//
// Windows shows the SDL cursor when starting in fullscreen mode
// then switching to window mode. This hides the cursor again.
SDL_ShowCursor(SDL_ENABLE);
SDL_ShowCursor(SDL_DISABLE);
#endif
#if defined(USE_OPENGL) || defined(USE_GLES)
if (UseOpenGL) {
ReloadOpenGL();
} else
#endif
{
SDL_LockSurface(TheScreen);
memcpy(TheScreen->pixels, pixels, framesize);
delete[] pixels;
if (TheScreen->format->palette) {
// !!! FIXME : No idea if that flags param is right.
SDL_SetPalette(TheScreen, SDL_LOGPAL, palette, 0, ncolors);
delete[] palette;
}
SDL_UnlockSurface(TheScreen);
}
SDL_SetClipRect(TheScreen, &clip);
Invalidate(); // Update display
#else // !USE_WIN32
SDL_WM_ToggleFullScreen(TheScreen);
#endif
Video.FullScreen = (TheScreen->flags & SDL_FULLSCREEN) ? 1 : 0;
}
示例2: check
void FSingleTileEditorViewportClient::SetTileIndex(int32 InTileIndex)
{
const int32 OldTileIndex = TileBeingEditedIndex;
const bool bNewIndexValid = (InTileIndex >= 0) && (InTileIndex < TileSet->GetTileCount());
TileBeingEditedIndex = bNewIndexValid ? InTileIndex : INDEX_NONE;
FSpriteGeometryEditMode* GeometryEditMode = ModeTools->GetActiveModeTyped<FSpriteGeometryEditMode>(FSpriteGeometryEditMode::EM_SpriteGeometry);
check(GeometryEditMode);
FSpriteGeometryCollection* GeomToEdit = nullptr;
if (TileBeingEditedIndex != INDEX_NONE)
{
if (FPaperTileMetadata* Metadata = TileSet->GetMutableTileMetadata(InTileIndex))
{
GeomToEdit = &(Metadata->CollisionData);
}
}
// Tell the geometry editor about the new tile (if it exists)
GeometryEditMode->SetGeometryBeingEdited(GeomToEdit, /*bAllowCircles=*/ true, /*bAllowSubtractivePolygons=*/ false);
// Update the visual representation
UPaperSprite* DummySprite = nullptr;
if (TileBeingEditedIndex != INDEX_NONE)
{
DummySprite = NewObject<UPaperSprite>();
DummySprite->SpriteCollisionDomain = ESpriteCollisionMode::None;
DummySprite->PivotMode = ESpritePivotMode::Center_Center;
DummySprite->CollisionGeometry.GeometryType = ESpritePolygonMode::SourceBoundingBox;
DummySprite->RenderGeometry.GeometryType = ESpritePolygonMode::SourceBoundingBox;
FSpriteAssetInitParameters SpriteReinitParams;
SpriteReinitParams.Texture = TileSet->GetTileSheetTexture();
//@TODO: Should analyze the texture (*at a higher level, not per tile click!*) to pick the correct material
FVector2D UV;
TileSet->GetTileUV(TileBeingEditedIndex, /*out*/ UV);
SpriteReinitParams.Offset = FIntPoint((int32)UV.X, (int32)(UV.Y));
SpriteReinitParams.Dimension = TileSet->GetTileSize();
SpriteReinitParams.SetPixelsPerUnrealUnit(1.0f);
DummySprite->InitializeSprite(SpriteReinitParams);
}
PreviewTileSpriteComponent->SetSprite(DummySprite);
// Update the default geometry bounds
const FVector2D HalfTileSize(TileSet->GetTileSize().X * 0.5f, TileSet->GetTileSize().Y * 0.5f);
FBox2D DesiredBounds(ForceInitToZero);
DesiredBounds.Min = -HalfTileSize;
DesiredBounds.Max = HalfTileSize;
GeometryEditMode->SetNewGeometryPreferredBounds(DesiredBounds);
// Zoom to fit when we start editing a tile and weren't before, but leave it alone if we just changed tiles, in case they zoomed in or out further
if ((TileBeingEditedIndex != INDEX_NONE) && (OldTileIndex == INDEX_NONE))
{
RequestFocusOnSelection(/*bInstant=*/ true);
}
// Trigger a details panel customization rebuild
OnSingleTileIndexChanged.Broadcast(TileBeingEditedIndex, OldTileIndex);
// Redraw the viewport
Invalidate();
}
示例3: Invalidate
void CDateTimeUI::SetTime(SYSTEMTIME* pst)
{
m_sysTime = *pst;
Invalidate();
}
示例4: wxASSERT
void Styler_SearchHL::Delete(unsigned int start_pos, unsigned int end_pos) {
wxASSERT(0 <= start_pos && start_pos <= m_doc.GetLength());
if (m_text.empty()) return;
if (start_pos == end_pos) return;
wxASSERT(end_pos > start_pos);
// Check if we have deleted the entire document
if (m_doc.GetLength() == 0) {
Invalidate();
return;
}
// Adjust start & end
unsigned int length = end_pos - start_pos;
if (m_search_start >= start_pos) {
if (m_search_start > end_pos) m_search_start -= length;
else m_search_start = start_pos;
}
if (m_search_end > start_pos) {
if (m_search_end > end_pos) m_search_end -= length;
else m_search_end = start_pos;
}
else return; // Change after search area, no need to re-search
unsigned int search_start = m_search_start;
if (!m_matches.empty()) {
if (start_pos >= m_matches.back().end) {
// Do a new search from end of last match
DoSearch(search_start, m_search_end, true);
return;
}
// Find matches touched by deletion and remove those. Update all following
bool is_first = true;
vector<interval>::iterator p = m_matches.begin();
while (p != m_matches.end()) {
if (p->end > start_pos) {
// Remember first valid match before pos
if (is_first) {
if (p != m_matches.begin()) search_start = (p-1)->end;
is_first = false;
}
if (p->start < end_pos) {
// pos inside match. Delete and continue
p = m_matches.erase(p);
if (p != m_matches.end()) continue; // new iterator
else break;
}
else {
// Move match to correct position
p->start -= length;
p->end -= length;
}
}
++p;
}
}
// Do a new search starting from end of first match before pos
DoSearch(search_start, m_search_end, false);
}
示例5: Invalidate
void FSingleTileEditorViewportClient::MarkTransactionAsDirty()
{
bManipulationDirtiedSomething = true;
Invalidate();
}
示例6: glGetIntegerv
//.........这里部分代码省略.........
}
m_pDepthTexture->m_Width = m_Width;
m_pDepthTexture->m_Height = m_Height;
}
// create the texture
if( m_pColorTexture && m_pColorTexture->m_TextureID != 0 )
{
glBindTexture( GL_TEXTURE_2D, m_pColorTexture->m_TextureID );
//glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, m_TextureWidth, m_TextureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, m_TextureWidth, m_TextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_MinFilter );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_MagFilter );
glBindTexture( GL_TEXTURE_2D, 0 );
checkGlError( "glBindTexture" );
}
// create a depth renderbuffer.
if( m_pDepthTexture && m_pDepthTexture->m_TextureID != 0 )
{
#if !MYFW_OPENGLES2
GLint depthformat = GL_DEPTH_COMPONENT32;
if( m_DepthBits == 24 )
depthformat = GL_DEPTH_COMPONENT24;
else if( m_DepthBits == 16 )
depthformat = GL_DEPTH_COMPONENT16;
#else
GLint depthformat = GL_DEPTH_COMPONENT16;
#endif
if( m_DepthIsTexture )
{
glBindTexture( GL_TEXTURE_2D, m_pDepthTexture->m_TextureID );
checkGlError( "glBindTexture" );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
checkGlError( "glTexParameteri" );
glTexImage2D( GL_TEXTURE_2D, 0, depthformat, m_TextureWidth, m_TextureHeight, 0,
GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0 );
//GL_DEPTH_COMPONENT, GL_FLOAT, 0 );
checkGlError( "glTexImage2D" );
glBindTexture( GL_TEXTURE_2D, 0 );
checkGlError( "glBindTexture" );
}
else
{
glBindRenderbuffer( GL_RENDERBUFFER, m_pDepthTexture->m_TextureID );
glRenderbufferStorage( GL_RENDERBUFFER, depthformat, m_TextureWidth, m_TextureHeight );
checkGlError( "glRenderbufferStorageEXT" );
}
}
// attach everything to the FBO
{
MyBindFramebuffer( GL_FRAMEBUFFER, m_FrameBufferID, 0, 0 );
// attach color texture
if( m_pColorTexture && m_pColorTexture->m_TextureID != 0 )
glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pColorTexture->m_TextureID, 0 );
// attach depth renderbuffer
if( m_pDepthTexture && m_pDepthTexture->m_TextureID != 0 )
{
if( m_DepthIsTexture )
{
glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthTexture->m_TextureID, 0 );
}
else
{
glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_pDepthTexture->m_TextureID );
}
}
MyBindFramebuffer( GL_FRAMEBUFFER, 0, 0, 0 );
checkGlError( "glBindFramebufferEXT" );
}
// any problems?
GLint status = glCheckFramebufferStatus( GL_FRAMEBUFFER );
checkGlError( "glCheckFramebufferStatus" );
if( status != GL_FRAMEBUFFER_COMPLETE )
{
LOGInfo( LOGTag, "CreateFBO - error\n" );
//MyAssert( false );
Invalidate( true );
return false;
}
LOGInfo( LOGTag, "CreateFBO - complete (%d, %d)\n", m_TextureWidth, m_TextureHeight );
#else
return false;
#endif
return true;
}
示例7: _nc_mouse_parse
static bool
_nc_mouse_parse(SCREEN *sp, int runcount)
/* parse a run of atomic mouse events into a gesture */
{
MEVENT *eventp = sp->_mouse_eventp;
MEVENT *next, *ep;
MEVENT *first_valid = NULL;
MEVENT *first_invalid = NULL;
int n;
int b;
bool merge;
bool endLoop;
TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount));
/*
* When we enter this routine, the event list next-free pointer
* points just past a run of mouse events that we know were separated
* in time by less than the critical click interval. The job of this
* routine is to collapse this run into a single higher-level event
* or gesture.
*
* We accomplish this in two passes. The first pass merges press/release
* pairs into click events. The second merges runs of click events into
* double or triple-click events.
*
* It's possible that the run may not resolve to a single event (for
* example, if the user quadruple-clicks). If so, leading events
* in the run are ignored if user does not call getmouse in a loop (getting
* them from newest to older).
*
* Note that this routine is independent of the format of the specific
* format of the pointing-device's reports. We can use it to parse
* gestures on anything that reports press/release events on a per-
* button basis, as long as the device-dependent mouse code puts stuff
* on the queue in MEVENT format.
*/
/*
* Reset all events that were not set, in case the user sometimes calls
* getmouse only once and other times until there are no more events in
* queue.
*
* This also allows reaching the beginning of the run.
*/
ep = eventp;
for (n = runcount; n < EV_MAX; n++) {
Invalidate(ep);
ep = NEXT(ep);
}
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_trace_slot(sp, "before mouse press/release merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
RunParams(sp, eventp, ep),
runcount);
_nc_unlock_global(tracef);
}
#endif /* TRACE */
/* first pass; merge press/release pairs */
endLoop = FALSE;
while (!endLoop) {
next = NEXT(ep);
if (next == eventp) {
/* Will end the loop, but compact before */
endLoop = TRUE;
} else {
#define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \
== !(next->bstate & MASK_RELEASE(x)))
if (ValidEvent(ep) && ValidEvent(next)
&& ep->x == next->x && ep->y == next->y
&& (ep->bstate & BUTTON_PRESSED)
&& (!(next->bstate & BUTTON_PRESSED))) {
bool changed = TRUE;
for (b = 1; b <= MAX_BUTTONS; ++b) {
if (!MASK_CHANGED(b)) {
changed = FALSE;
break;
}
}
if (changed) {
merge = FALSE;
for (b = 1; b <= MAX_BUTTONS; ++b) {
if ((sp->_mouse_mask & MASK_CLICK(b))
&& (ep->bstate & MASK_PRESS(b))) {
next->bstate &= ~MASK_RELEASE(b);
next->bstate |= MASK_CLICK(b);
merge = TRUE;
}
}
if (merge) {
Invalidate(ep);
}
}
//.........这里部分代码省略.........
示例8: Invalidate
void EventSheetEditor::OnMouseMove(UINT nFlags, CPoint point)
{
if(!m_pHeader)
return;
m_ObjectHeaderTooltip.ShowAt(point, *this);
m_Mouse = point;
m_pHeader->OnMouseMove(point);
if(m_pHeader->m_isDrag)
Invalidate();
else
{
// Is is possible we might be dragging.
if(!m_Drag.IsDragging && m_leftDown)
{
if( ( (point.x - m_Drag.StoredPos.x)*(point.x - m_Drag.StoredPos.x)
+(point.y - m_Drag.StoredPos.y)*(point.y - m_Drag.StoredPos.y)) > 8)
{
switch (m_Drag.dragtype)
{
case EVENT:
{
SelectedEventVector m_SelectedEvents;
CreateEventSelectionVectorLimited(m_SelectedEvents,(*m_pEventList));
CEditorDragEvents* Events = new CEditorDragEvents;
Events->pEd = this;
Events->m_pSelectedEvents = &m_SelectedEvents;
DROPEFFECT de = DROPEFFECT_COPY;
m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Events",Events,&de);
// wait till the drop is done...then....
m_Drag.dragtype = -1;
m_Drag.IsDragging = false;
Invalidate();
}
break;
case CONDITION:
{
SelectedConditionVector m_SelectedConditions;
CreateConditionSelectionVector(m_SelectedConditions,(*m_pEventList));
CEditorDragConditions* Conditions = new CEditorDragConditions;
Conditions->pEd = this;
Conditions->m_pSelectedConditions = &m_SelectedConditions;
DROPEFFECT de = DROPEFFECT_COPY;
m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Conditions",Conditions,&de);
// wait till the drop is done..then...
m_Drag.dragtype = -1;
m_Drag.IsDragging = false;
Invalidate();
m_SelectedConditions.clear();
}
break;
case ACTION:
{
SelectedActionVector m_SelectedActions;
CreateActionSelectionVector(m_SelectedActions,(*m_pEventList));
CEditorDragActions* Actions = new CEditorDragActions;
Actions->pEd = this;
Actions->m_pSelectedActions = &m_SelectedActions;
DROPEFFECT de = DROPEFFECT_COPY;
m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Actions",Actions,&de);
// wait till the drop is done..then...
m_Drag.dragtype = -1;
m_Drag.IsDragging = false;
Invalidate();
m_SelectedActions.clear();
}
break;
case OBJECT:
{
CEditorDragObject* Objects = new CEditorDragObject;
Objects->pEd = (EventSheetEditor*)this;
Objects->ObjectIdentifier = m_pHeader->GetObjectAtX(m_Drag.StoredPos.x)->oid;
DROPEFFECT de = DROPEFFECT_COPY;
m_pDDMgr->PrepareDrop(DO_DRAGDROP,"Construct Object",Objects,&de);
// wait till the drop is done..then...
m_Drag.dragtype = -1;
m_Drag.IsDragging = false;
Invalidate();
}
break;
default:
break;
}
//.........这里部分代码省略.........
示例9: Invalidate
/*****************************************************************************
* Function - Update
* DESCRIPTION: Check if pointer pSubject is one of the subjects observed.
* If it is then put the pointer in queue and request task time for sub task.
*
*****************************************************************************/
void InputFunctionState::Update(Subject* pSubject)
{
Invalidate();
}
示例10: Invalidate
//绘画背景
BOOL CPlazaViewItem::OnEraseBkgnd(CDC * pDC)
{
Invalidate(FALSE);
UpdateWindow();
return TRUE;
}
示例11: EventAt
void EventSheetEditor::OnLButtonDown(UINT nFlags, CPoint pt)
{
if (!(pt.x >= m_pHeader->m_Split - 2 && pt.x <= m_pHeader->m_Split + 5))
{
CEditorEvent* pEvent = EventAt(pt);
if(pEvent)
{
if(pEvent->canAddActions())
{
if(pEvent->mouseOverNewAction)
{
AddAction(pEvent, -1);
return;
}
if(pEvent->mouseOverFooter)
{
AddCondition(false, NULL, true, pEvent);
return;
}
}
}
}
if(KillFocusOnInlineEditor())
return;
m_ActionTooltip.Hide();
CEditorEvent* pMyEventParent = NULL;
CEditorEvent* pMyEvent = EventAt(pt, &pMyEventParent);
m_leftDown = true;
//if(m_pHeader->m_rect.PtInRect(pt))
if(pt.x >= m_pHeader->m_Split - 2 && pt.x <= m_pHeader->m_Split + 5)
{
m_InsertAfter.Hide();
m_InsertBefore.Hide();
m_InsertSub.Hide();
m_ActionTooltip.Hide();
m_pHeader->OnLeftClick(pt);
if(m_pHeader->m_isDrag)
{
SetCapture();
}
else // basically just if we arn't doing something interesting in the header...
{
if(!m_CtrlDown)
{
DeselectEvents();
DeselectActions();
DeselectConditions();
}
}
for(int a = 0; a < m_pHeader->m_Objects.size(); a ++ )
{
if(m_pHeader->m_Objects.at(a).m_rect.PtInRect(pt))
{
m_Drag.dragtype = OBJECT;
m_Drag.StoredPos = pt;
m_Drag.CtrlDown = false;
}
}
}
else if(pMyEvent)
{
if(pMyEvent->PtInOnOffButton(pt, this))
{
// The user is clicked the + button
pMyEvent->m_open(this) = pMyEvent->m_open(this) ? false:true;
Invalidate();
}
else
{
///////////////
// Select Condition
CEditorCondition* pMyCondition = pMyEvent->conditionAt(pt, this);
if(pMyCondition)
{
// find index
int index = 0;
for(int a = 0; a < pMyEvent->m_Conditions.size() ; a ++ )
if(pMyEvent->m_Conditions[a] == pMyCondition)
index = a;
//Deselect selected events or actions
DeselectEvents();
DeselectActions();
// Now the conditions
if(pMyCondition->m_select(this)) // if we clicked on something already selected...wait till release
m_ClickedSelectedCondition = true;
else
{
//.........这里部分代码省略.........
示例12: Invalidate
void CSkinSliderCtrl::StartLoopArrow()
{
m_bLoopArrow = TRUE;
Invalidate();
}
示例13: Invalidate
void CHoverButton::OnMouseHover(WPARAM wparam, LPARAM lparam)
{
// TODO: Add your message handler code here and/or call default
m_bHover=TRUE;
Invalidate();
}
示例14: Invalidate
void CWndImage::SetBackgroundBrush(CBrush & brush)
{
m_backBrush = (HBRUSH) brush.m_hObject;
Invalidate();
}
示例15: ReplaceItemData
// Sets the image to use in a list box item
//
// Parameters:
// [IN] nIndex
// Specifies the zero-based index of the item.
// [IN] nImage
// Specifies the zero-based index of the image
// inside the imagelist to use.
// [IN] bRepaint
// If TRUE the control will be repainted.
//
void CListBoxST::SetImage(int nIndex, int nImage, BOOL bRepaint)
{
ReplaceItemData(nIndex, 0, NULL, nImage, 0, MASK_NIMAGE);
if (bRepaint) Invalidate();
} // End of SetImage