本文整理汇总了C++中SetCurrent函数的典型用法代码示例。如果您正苦于以下问题:C++ SetCurrent函数的具体用法?C++ SetCurrent怎么用?C++ SetCurrent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetCurrent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostSizeEvent
void MyGLCanvas::OnSize(wxSizeEvent& event)
{
event.Skip();
// If this window is not fully initialized, dismiss this event
if ( !IsShownOnScreen() )
return;
if ( !m_oglManager )
{
//Now we have a context, retrieve pointers to OGL functions
if ( !oglInit() )
return;
//Some GPUs need an additional forced paint event
PostSizeEvent();
}
// This is normally only necessary if there is more than one wxGLCanvas
// or more than one wxGLContext in the application.
SetCurrent(*m_oglContext);
// It's up to the application code to update the OpenGL viewport settings.
m_winHeight = event.GetSize().y;
m_oglManager->SetViewport(0, 0, event.GetSize().x, m_winHeight);
// Generate paint event without erasing the background.
Refresh(false);
}
示例2: WXUNUSED
void GLAnimationCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// must always be here
wxPaintDC dc(this);
SetCurrent(*m_pGLRC);
// Initialize OpenGL
if (!m_gldata.initialized)
{
InitGL();
ResetProjectionMode();
m_gldata.initialized = true;
}
static DWORD last = timeGetTime();
DWORD curr = timeGetTime();
DWORD delta = curr - last;
last = curr;
CAnimationManager::GetInstance()->Update((float)delta/1000);
CRenderManager::GetInstance()->Render();
SwapBuffers();
}
示例3: MENUDEB
void cReplayList::RebuildList() {
int nItems=playList->GetNIdx();
MENUDEB("RebuildList nItems %d \n",nItems);
cPlayListItem * Item;
for (int i = 0; i < nItems; i++) {
Item=playList->GetItemByIndex(i);
if (!Item) {
printf("Error getting all files for list index %d\n",
i);
continue;
};
MENUDEB("Add item %d (%p) %s\n",
i,Item,Item->GetName());
char ItemStr[100];
PrintItemStr(ItemStr,100,Item);
Add(new cOsdItem(ItemStr,osUnknown),false);
};
lastListItemCount = playList->GetNIdx();
playList->SetClean();
SetCurrent(Get(playList->GetCurrIdx()));
lastActivity=time(NULL)-600;
};
示例4: SetCurrent
void subPageSpells::Prev(unsigned int n)
{
SetCurrent();
std::vector<Spell*> *pSpells = ¤tSchool->spells;
if ( n > spellNumber )
{
spellItr = pSpells->begin();
currentSpell = *spellItr;
spellNumber = 1;
return;
}
for ( ; n > 0; n-- )
{
spellNumber--;
if ( spellItr == pSpells->begin() )
{
spellItr = pSpells->end();
spellNumber = currentSchool->spells.size();
}
spellItr--;
currentSpell = *spellItr;
}
GetCurrent();
}
示例5: wxGLCanvas
//---------------------------- PROTECTED -----------------------------//
wxCoreGLCanvas::wxCoreGLCanvas(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name,
wxInt32 *attrib)
: wxGLCanvas(parent, id, pos, size, style, name, attrib)
, mpTopLevelWindow(dynamic_cast<wxTopLevelWindow *>(parent))
, mDirty(true)
#ifdef __WXGTK__
, mPainted(false)
#endif
{
if (GetContext())
{
SetCurrent();
// Initialize glew extensions.
GLenum err = glewInit();
if(GLEW_OK != err)
{
wxLogError(
wxT("No OpenGL extensions are available on this hardware."));
}
InitGL(this);
}
}
示例6: wxASSERT
wxBitmap wxSettlersGLCanvas::ConvertGLtoWX(const DrawObjectPtr &object,
const size_t width,
const size_t height,
const Vector &eye)
{
wxASSERT(object);
wxImage image;
if( (FALSE != GetContext()) &&
(0 < width) &&
(0 < height))
{
SetCurrent();
//try to use a 4x size image for creating the initial image, which will
//be scaled down to required size and then cropped if needed
size_t dim = std::max(width, height);
size_t size = (dim << 2);
// If we're using pixel buffers, we have to stay within the render
// buffer boundary size.
if( (Pixelbuffer == mRenderToBitmapMode) &&
(RENDER_TEXTURE_SIZE < size))
{
size >>= 1;
// This should never happen, but be safe.
if(RENDER_TEXTURE_SIZE < size)
{
size = dim;
wxASSERT(RENDER_TEXTURE_SIZE >= size);
}
}
示例7: MYDEBUG
void cCMDMove::Build(char *dir)
{
MYDEBUG("Verzeichnis: Move: Erstelle Verzeichnisliste: %s", dir);
if(!dir)
dir = CurrentDir();
Clear();
cDirHandling *DirHand = new cDirHandling(this, this);
SetCurrent(Get(DirHand->Build(dir, true)));
delete(DirHand);
if(Count())
{
cMainMenuItem *item = (cMainMenuItem*)First();
while(item)
{
if(!strcasecmp(item->FileName(), File))
{
Del(item->Index());
break;
}
item = (cMainMenuItem*)Next(item);
}
}
Display();
SetHelp();
}
示例8: while
void CBINDInstallDlg::UnregisterMessages(BOOL uninstall) {
BOOL rc = FALSE;
HKEY hKey = NULL;
while(1) {
SetCurrent(IDS_UNREGISTER_MESSAGES);
/* Open key for Application Event Log */
if (RegOpenKey(HKEY_LOCAL_MACHINE, EVENTLOG_APP_SUBKEY, &hKey)
!= ERROR_SUCCESS)
break;
/* Remove named from the list of messages sources */
if (RegDeleteKey(hKey, BIND_MESSAGE_NAME) != ERROR_SUCCESS)
break;
rc = TRUE;
break;
}
if (hKey)
RegCloseKey(hKey);
if (uninstall)
SetItemStatus(IDC_REG_MESSAGE, rc);
}
示例9: UpdateData
/*
* User pressed the uninstall button. Make it go.
*/
void CBINDInstallDlg::OnUninstall() {
UpdateData();
if (MsgBox(IDS_UNINSTALL, MB_YESNO) == IDYES) {
if (CheckBINDService())
StopBINDService();
SC_HANDLE hSCManager = OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS);
if (!hSCManager) {
MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage());
return;
}
SC_HANDLE hService = OpenService(hSCManager, BIND_SERVICE_NAME,
SERVICE_ALL_ACCESS);
if (!hService && GetLastError() != ERROR_SERVICE_DOES_NOT_EXIST){
MsgBox(IDS_ERR_OPEN_SERVICE, GetErrMessage());
return;
}
SERVICE_STATUS ss;
QueryServiceStatus(hService, &ss);
if (ss.dwCurrentState == SERVICE_RUNNING) {
BOOL rc = ControlService(hService,
SERVICE_CONTROL_STOP, &ss);
if (rc == FALSE || ss.dwCurrentState != SERVICE_STOPPED) {
MsgBox(IDS_ERR_STOP_SERVICE, GetErrMessage());
return;
}
}
CloseServiceHandle(hService);
CloseServiceHandle(hSCManager);
// Directories
m_etcDir = m_targetDir + "\\etc";
m_binDir = m_targetDir + "\\bin";
UninstallTags();
UnregisterMessages(TRUE);
UnregisterService(TRUE);
DeleteFiles(TRUE);
if (m_keepFiles == FALSE)
RemoveDirs(TRUE);
else
GetDlgItem(IDC_CREATE_DIR)->SetWindowText("Not Removed");
// Delete registry keys for named
RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SESSION_SUBKEY);
RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY);
RegDeleteKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY);
ProgramGroup(FALSE);
SetCurrent(IDS_UNINSTALL_DONE);
MsgBox(IDS_UNINSTALL_DONE);
}
}
示例10: Clear
void cMenuBouquetsList::Setup(cChannel * channel)
{
Clear();
cChannel *currentChannel =
channel ? channel : Channels.GetByNumber(cDevice::CurrentChannel());
cMenuBouquetItem *currentItem = NULL;
while (currentChannel && !currentChannel->GroupSep())
{
if (currentChannel->Prev())
currentChannel = (cChannel *) currentChannel->Prev();
else
break;
}
for (cChannel * channel = (cChannel *) Channels.First(); channel;
channel = (cChannel *) channel->Next())
{
//printf("##cMenuBouquetsList::Setup, channel->Name() = %s\n", channel->Name());
if (channel->GroupSep() && !(FilteredBouquetIsEmpty(channel) && mode_ == 1))
{
cMenuBouquetItem *item = new cMenuBouquetItem(channel);
Add(item);
if (!currentItem && item->Bouquet() == currentChannel)
currentItem = item;
}
}
if (!currentItem)
currentItem = (cMenuBouquetItem *) First();
SetCurrent(currentItem);
Options();
Display();
}
示例11: wxGLContext
//=========================================================================================
void GAVisToolCanvas::SetupOpenGL( void )
{
context = new wxGLContext( this );
SetCurrent( *context );
glClearColor( 1.f, 1.f, 1.f, 1.f );
glLineWidth( 1.5f );
glEnable( GL_LINE_SMOOTH );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE );
glShadeModel( GL_SMOOTH );
GLfloat lightColor[] = { 1.f, 1.f, 1.f, 1.f };
GLfloat lightPos[] = { 1000.f, 1000.f, 500.f };
GLfloat lightSpec[] = { 0.3f, 0.3f, 0.3f, 0.3f };
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
glLightfv( GL_LIGHT0, GL_DIFFUSE, lightColor );
glLightfv( GL_LIGHT0, GL_POSITION, lightPos );
glLightfv( GL_LIGHT0, GL_SPECULAR, lightSpec );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
}
示例12: GetBouquet
eOSState cMenuBouquetsList::DeleteBouquet()
{
if (Interface->Confirm(tr("Delete Bouquet?")))
{
cChannel *bouquet = GetBouquet(Current());
cChannel *next = (cChannel *) bouquet->Next();
/* Delete all channels up to the beginning */
/* of the next bouquet */
while (next && !next->GroupSep())
{
cChannel *p = next;
next = (cChannel *) next->Next();
Channels.Del(p);
}
/* Delete the bouquet itself */
Channels.Del(bouquet);
/* Remove the OSD-item */
cOsdMenu::Del(Current());
Propagate();
if (Current() < -1)
SetCurrent(0);
return osContinue;
}
return osContinue;
}
示例13: GetCurrent
int CoroutineMgr::Yield(int coid )
{
Coroutine * cur = GetCurrent();
if(!cur)
{
LOG_FATAL("current co is null !");
return -1;
}
Coroutine * co = Find(coid);
if(0 == coid)
{
//switch to prev
co = cur->from;
}
if(!co)
{
LOG_FATAL("current from co is null !");
return -1;
}
if(cur->bState == Coroutine::COROUTINE_STATUS_RUNNING)
{
cur->bState = Coroutine::COROUTINE_STATUS_SUSPEND;
}
co->bState = Coroutine::COROUTINE_STATUS_RUNNING;
SetCurrent(co);
LOG_INFO("co = %d is yield schedule next = %d for = %d",cur->iID,co->iID,coid);
swapcontext(&(cur->ctx),&(co->ctx));
return retval;
}
示例14: SwitchTimersLock
cMenuEpgTimers::cMenuEpgTimers(void)
:cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6), SwitchTimersLock(&SwitchTimers)
{
if (strcmp(Skins.Current()->Name(), "Reel") == 0)
#if APIVERSNUM < 10700
SetCols(3, 10, 6, 10, 6);
#else
#if REELVDR && APIVERSNUM >= 10718
SetCols(3, 12, 7, 6);
#else
SetCols(3, 12, 7, 12, 7);
#endif /* REELVDR && APIVERSNUM >= 10718 */
#endif
#if REELVDR && APIVERSNUM >= 10718
EnableSideNote(true);
#endif
helpKeys = -1;
Set();
SetCurrent(First());
SetHelpKeys();
/* get timer state */
TimerState_=0;
Timers.Modified(TimerState_);
#ifdef USEMYSQL
LastEventID_ = -1;
LastEventID_ = Timers.GetLastEventID();
#endif
}
示例15: SetCurrent
void BaseCanvas::setup(const PartitionView *partitionView)
{
m_partitionView = partitionView;
SetCurrent();
int width, height;
GetSize(&width, &height);
// Enable back-face culling.
glCullFace(GL_BACK);
glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);
// Set up the z-buffer.
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
// Set up alpha testing.
glAlphaFunc(GL_NOTEQUAL, 0);
glEnable(GL_ALPHA_TEST);
glClearColor(0, 0, 0, 0);
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, height, 0, 0.0, 2048.0);
}