BOOL CGameDlg::OnInitDialog() { //mainBGM(); CDialogEx::OnInitDialog(); InitBackground(); InitElement(); InitMask(); InitComboMask(); InitComboInit(); Pause(); UpdateWindow(); Score = 0; ShowScore(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon return TRUE;// return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
static int CreateElement( const char *name, /* Name of the element. */ int create) /* Boolean, whether the element is being * created explicitly (being registered) or * implicitly (by a derived element). */ { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr, *engineEntryPtr; Tcl_HashSearch search; int newEntry, elementId, genericId = -1; char *dot; StyleEngine *enginePtr; /* * Find or create the element. */ entryPtr = Tcl_CreateHashEntry(&tsdPtr->elementTable, name, &newEntry); if (!newEntry) { elementId = PTR2INT(Tcl_GetHashValue(entryPtr)); if (create) { tsdPtr->elements[elementId].created = 1; } return elementId; } /* * The element didn't exist. If it's a derived element, find or create its * generic element ID. */ dot = strchr(name, '.'); if (dot) { genericId = CreateElement(dot+1, 0); } elementId = tsdPtr->nbElements++; Tcl_SetHashValue(entryPtr, INT2PTR(elementId)); /* * Reallocate element table. */ tsdPtr->elements = ckrealloc(tsdPtr->elements, sizeof(Element) * tsdPtr->nbElements); InitElement(tsdPtr->elements+elementId, Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId, genericId, create); /* * Reallocate style engines' element table. */ engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (engineEntryPtr != NULL) { enginePtr = Tcl_GetHashValue(engineEntryPtr); enginePtr->elements = ckrealloc(enginePtr->elements, sizeof(StyledElement) * tsdPtr->nbElements); InitStyledElement(enginePtr->elements+elementId); engineEntryPtr = Tcl_NextHashEntry(&search); } return elementId; }