void Aligner::BuildDefaultMatrix(void) { ClearMatrices(); score_matrix_ = new int8_t[score_matrix_size_ * score_matrix_size_]; BuildSwScoreMatrix(match_score_, mismatch_penalty_, score_matrix_); translation_matrix_ = new int8_t[SizeOfArray(kBaseTranslation)]; memcpy(translation_matrix_, kBaseTranslation, sizeof(int8_t) * SizeOfArray(kBaseTranslation)); }
void main() { { int abc[3]; int abcd[4]; int *x = &abc[0]; SomeFn(x); // Так можно SomeFn(abc); // Так можно SomeFn(abcd); // Так можно SomeFn1(abc); // Так можно //SomeFn1(abcd); // Так нельзя // SomeFn1(x); так нельзя } // Глобальные переменные-массивы по умолчанию инициализируются нуляем assert(g_globalArray[0] == 0 && g_globalArray[1] == 0 && g_globalArray[2] == 0); // Массив из 3-х элементов. Элементы не проинициализированы float floatNumbers[3]; floatNumbers[0] = 1.0; floatNumbers[1] = 3.5; floatNumbers[2] = -4.5; // Массив при объявлении может быть проинициализирован double doubleNumbers[3] = { 3.8, 2.1, 3.53 }; // Элементы массива, не указанные при инициализации, равны нулю double zeroFilledArray[3] = { 3.5, 7.2 }; assert(zeroFilledArray[2] == 0.0); // Элементы проинициализированы нулями double zeroInitializedArray[3] = { }; // Если не указать размер массива при инициализации, // он будет определен автоматически double arrayOf5Items[] = { 3.5, 8.7, 2.3, -1.25, 0.0 }; std::string name = "John", surname = "Doe"; // При инициализации элементов массив могут также использоваться выражения std::string userNames[] = { "Ivan", "Sergey", name + " " + surname }; // Так можно определить количество элементов в массиве assert(std::end(userNames) - std::begin(userNames) == 3); // Также можно воспользоваться вспомогательной объявленонй выше функцией SizeOfArray assert(SizeOfArray(userNames) == 3); assert(userNames[2] == "John Doe"); // Константный массив из 5 элементов const char arr1[] = { 'J', 'o', 'h', 'n', '\0' }; assert(std::end(arr1) - std::begin(arr1) == 5); // Неконстантный массив из 4 элементов char arr2[] = "Doe"; assert(SizeOfArray(arr2) == 4); // Константный массив из 6 элементов const char arr3[6] = "Hello"; assert(SizeOfArray(arr3) == 6); }
// Routine to load date qualifier strings from resources. Do not call before AfApp has m_hinst. void LoadDateQualifiers() { if (g_fDoneDateQual) return; int i; for (i = 0; i < 5; i++) { StrUni stu(g_rgridDateQual1[i]); Assert(stu.Length() < knPrecLen); wcscpy_s(g_rgchwPrecFull[i], SizeOfArray(g_rgchwPrecFull[i]), stu.Chars()); StrAnsi sta(g_rgridDateQual1[i]); Assert(sta.Length() < knPrecLen); strcpy_s(g_rgchPrecFull[i], sta.Chars()); } for (i = 0; i < 2; i++) { StrUni stu(g_rgridDateQual2[i]); Assert(stu.Length() < knAdBcLen); wcscpy_s(g_rgchwBC_ADFull[i], SizeOfArray(g_rgchwBC_ADFull[i]), stu.Chars()); StrAnsi sta(g_rgridDateQual2[i]); Assert(stu.Length() < knAdBcLen); strcpy_s(g_rgchBC_ADFull[i], sta.Chars()); } for (i = 0; i < 3; i++) { StrUni stu(g_rgridDateBlank[i]); Assert(stu.Length() < knBlankLen); wcscpy_s(g_rgchwBlankFull[i], SizeOfArray(g_rgchwBlankFull[i]), stu.Chars()); StrAnsi sta(g_rgridDateBlank[i]); Assert(stu.Length() < knBlankLen); strcpy_s(g_rgchBlankFull[i], sta.Chars()); } g_fDoneDateQual = true; }
bool CKLBUIMultiImgItem::initCore(u32 order,float x,float y, u32 index, IMGITEM* pIndexes, u32 max) { if(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) { return false; } setInitPos(x, y); // 領域を確保 m_cntImg = max; m_items = pIndexes; if(!m_items) { return false; } m_idxMax = m_cntImg - 1; // 最大index値を追加する REFRESH_A; REFRESH_B; klb_assert((((s32)order) >= 0), "Order Problem"); m_order = order; setIndex(index); return true; }
unsigned int ON_BrepRegionArray::SizeOf() const { unsigned int sz = SizeOfArray(); for ( int i = 0; i < m_count; i++ ) sz += (m_a[i].SizeOf() - ((unsigned int)sizeof(ON_BrepRegion))); return sz; }
// Verilen hesap numarasindan bulundugu // dizindeki indeks numarasi hesaplanir, // bulunamazsa bulunamadigini belirten deger olarak -1 donulur int hesapBul(char* hesapNo) { int index; int arraySize = SizeOfArray(hesap_no); for(index = 0;index < arraySize; index++){ if(strcmp(hesapNo,hesap_no[index]) == 0){ return index; } } return -1; }
void CGeneticAlgorithm::Init() { { INI<> ini("data/DriverBehaviors.ini", true); for (auto § : ini.sections) { m_DrivingBehaviours.emplace_back(CDrivingBehavior(ini, sect.first)); } for (size_t i = ini.sections.size(); i < m_nNumDrivingBehaviors; i++) { m_DrivingBehaviours.emplace_back(CDrivingBehavior(30)); } } const std::string DriverNames[5] = { "Vanya", "Misha", "Maks", "Igor", "Snedr" }; size_t nNumDrivers = SizeOfArray(DriverNames); if (nNumDrivers > m_nNumDrivingBehaviors) nNumDrivers = m_nNumDrivingBehaviors; for (size_t i = 0; i < nNumDrivers; i++) { CDriver Driver; Driver.m_fCircleTime = 1.0f; Driver.m_nBehaviorID = rand() % m_DrivingBehaviours.size(); Driver.m_sDriverName = DriverNames[i % SizeOfArray(DriverNames)]; m_Drivers.push_back(Driver); } };
/*---------------------------------------------------------------------------------------------- Subclass an existing button window. ----------------------------------------------------------------------------------------------*/ void IconComboCombo::SubclassButton(HWND hwnd, int * pval, bool fShowText) { AssertPtr(pval); #ifdef DEBUG { // Make sure the window is really a button. achar rgch[10]; ::GetClassName(hwnd, rgch, SizeOfArray(rgch)); Assert(StrCmpI(rgch, _T("BUTTON")) == 0); } #endif ::SetWindowLong(hwnd, GWL_STYLE, ::GetWindowLong(hwnd, GWL_STYLE) | BS_OWNERDRAW); SuperClass::SubclassHwnd(hwnd); m_wid = ::GetDlgCtrlID(hwnd); Assert(m_wid); m_fShowText = fShowText; m_pival = pval; SetVal(*pval); SetWindowSize(); }
bool CKLBUISimpleItem::initCore(u32 order, float x, float y, const char* asset) { if(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) { return false; } setInitPos(x, y); klb_assert((((s32)order) >= 0), "Order Problem"); m_order = order; setStrC(m_asset, asset); m_pNode = CKLBUtility::createNodeScript( m_asset, m_order, &m_handle); if(!m_pNode) { return false; } getNode()->addNode(m_pNode); return true; }
int ReadCommands(const char *filename) { int handle = file_open(filename, FILE_OPEN_READ); if (handle < 0) { debug_printf("init: open error = %d\n", handle); return false; } ssize_t r = file_read(handle, buffer, sizeof(buffer)); (void)file_close(handle); if (r == 0) { debug_print("init: empty file\n"); return false; } else if (r < 0) { debug_printf("init: read error = %ld\n", (long)r); return false; } memset(MenuRecord, 0, sizeof(MenuRecord)); enum { STATE_SkipSpaces, STATE_ignore, STATE_icon, STATE_StartCommand, STATE_EndCommand, } state = STATE_SkipSpaces; size_t item = 0; ssize_t i; for (i = 0; i < r; ++i) { char c = buffer[i]; // parse: // <spaces> <icon> <spaces> : <spaces> <command> switch (state) { case STATE_SkipSpaces: if (';' == c || '#' == c) { state = STATE_ignore; } else if (!isspace(c)) { MenuRecord[item].IconName = &buffer[i]; state = STATE_icon; if ('\n' == c || ':' == c) { buffer[i] = '\0'; state = STATE_SkipSpaces; // ignore blank icon } } break; case STATE_ignore: if ('\n' == c) { state = STATE_SkipSpaces; } break; case STATE_icon: if ('\n' == c) { buffer[i] = '\0'; state = STATE_SkipSpaces; // ignore if command is missing } else if (':' == c) { buffer[i] = '\0'; size_t j; for (j = i - 1; j > 0 && isspace(buffer[j]) ; --j) { buffer[j] = '\0'; } if (ReadIcon(MenuRecord[item].icon, sizeof(MenuRecord[item].icon), MenuRecord[item].IconName)) { state = STATE_StartCommand; } else { state = STATE_SkipSpaces; // ignore invalid icon } } break; case STATE_StartCommand: if (!isspace(c)) { MenuRecord[item].command = &buffer[i]; state = STATE_EndCommand; if ('\n' == c) { buffer[i] = '\0'; state = STATE_SkipSpaces; // ignore blank commands } } break; case STATE_EndCommand: if ('\n' == c) { MenuRecord[item].ok = true; buffer[i] = '\0'; state = STATE_SkipSpaces; size_t j; for (j = i - 1; j > 0 && isspace(buffer[j]) ; --j) { buffer[j] = '\0'; } ++item; if (item >= SizeOfArray(MenuRecord)) { return true; } } break; } } return(item); }
int MenuHandler(void) { lcd_clear(LCD_WHITE); int x; int y; size_t i = 0; for (y = 0; y < Y_COUNT; ++y) { for (x = 0; x < X_COUNT; ++x) { if (MenuRecord[i].ok) { MenuRecord[i].x = X_START + (X_SIZE + X_GAP) * x; MenuRecord[i].y = Y_START + (Y_SIZE + Y_GAP) * y; lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES, MenuRecord[i].x, MenuRecord[i].y, X_SIZE, Y_SIZE, false, MenuRecord[i].icon); } ++i; } } event_flush(); int cursor = -1; // valid cursor positions are: 0 .. SizeOfArray(MenuRecord) - 1 for (;;) { event_t event; switch(event_wait(&event, NULL, NULL)) { // no callback, just power off case EVENT_NONE: break; case EVENT_KEY: break; case EVENT_TOUCH_DOWN: case EVENT_TOUCH_MOTION: { int position = CursorPosition(event.touch.x, event.touch.y); if (cursor != position) { if (cursor >= 0) { lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES, MenuRecord[cursor].x, MenuRecord[cursor].y, X_SIZE, Y_SIZE, false, MenuRecord[cursor].icon); } if (position >= 0 && position < (int)SizeOfArray(MenuRecord) && MenuRecord[position].ok) { cursor = position; lcd_bitmap(lcd_get_framebuffer(), LCD_BUFFER_WIDTH_BYTES, MenuRecord[cursor].x, MenuRecord[cursor].y, X_SIZE, Y_SIZE, true, MenuRecord[cursor].icon); } else { cursor = -1; } } } break; case EVENT_TOUCH_UP: if (cursor >= 0 && cursor < (int)SizeOfArray(MenuRecord)) { chain(MenuRecord[cursor].command); } break; case EVENT_BUTTON_DOWN: break; case EVENT_BUTTON_UP: break; case EVENT_BATTERY_LOW: break; } } return EXIT_POWER_OFF; }
void SceneDrawer::glInitWithShaders( int argc, char **argv ) { glutInit(&argc, argv); glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH ); glutInitWindowSize(GL_WIN_SIZE_X, GL_WIN_SIZE_Y); //glutInitWindowPosition(100, 100); glutCreateWindow ("User Selection Sample"); glutSetCursor( GLUT_CURSOR_NONE ); glutKeyboardFunc( glutKeyboard ); glutDisplayFunc( glutDisplayWithShaders ); glutIdleFunc( glutIdle ); glutReshapeFunc(resize); // Added Code GLint GlewInitResult = glewInit(); if (GLEW_OK != GlewInitResult) { printf("ERROR: %s\n",glewGetErrorString(GlewInitResult)); exit(EXIT_FAILURE); } // Initialize the texture InitTexture(); //---------------------------------------------------------------------- // BEGIN Background Shader Setup Code //---------------------------------------------------------------------- XnUInt16 g_nXRes; XnUInt16 g_nYRes; m_pUserTrackerObj->GetImageRes(g_nXRes,g_nYRes); //Vertex Array const GLfloat textureSurface[] = { 0.0, 0.0, 0.0, // Top Left point g_nXRes, 0.0, 0.0, // Top Right point g_nXRes, g_nYRes, 0.0, // Bottom Right point 0.0, g_nYRes, 0.0 }; // Bottom Left point // Color array for the vertex buffer object const GLubyte colors[] = { static_cast<GLubyte>(1), static_cast<GLubyte>(0), static_cast<GLubyte>(0), // Red static_cast<GLubyte>(0), static_cast<GLubyte>(1), static_cast<GLubyte>(0), // Green static_cast<GLubyte>(1), static_cast<GLubyte>(1), static_cast<GLubyte>(1), // Yellow static_cast<GLubyte>(1), static_cast<GLubyte>(1), static_cast<GLubyte>(1) }; // White const GLfloat texCoords[] = { 0.0, 0.0, (float)g_nXRes/texWidth, 0.0, (float)g_nXRes/texWidth, (float)g_nYRes/texHeight, 0.0, (float)g_nYRes/texHeight }; // Indices for the quadrilateral surface const GLuint indices[] = { 0, 1, 2, // Top right triangle 0, 3, 2 // Bottom left triangle }; // Find the number of vertices in the array g_numberVertices_Background = (GLuint)SizeOfArray( textureSurface ) / DIM_POSITION; const GLuint numberVertices_Background = g_numberVertices_Background; // Set the size of the interleaved array to the number of vertices //g_background = new vertexStruct[g_numberVertices_Background]; vertexStruct g_background[4]; // Find the number of indices in the geometry g_numberIndices_Background = SizeOfArray( indices ); //Fill the interleaved array. for( int i = 0; i < g_numberVertices_Background; i++ ){ for( int j = 0; j < DIM_POSITION; j++ ){ g_background[i].Position[j] = textureSurface[i * DIM_POSITION + j]; } for( int j = 0; j < DIM_NORMAL; j++ ){ g_background[i].Normal[j] = (GLfloat) 0.0f; // Not using surface normals in this implementation } for( int j = 0; j < DIM_COLOR; j++ ){ g_background[i].Color[j] = colors[i * DIM_COLOR + j]; } for( int j = 0; j < DIM_TEXCOORD; j++ ){ g_background[i].TexCoord[j] = texCoords[i * DIM_TEXCOORD + j]; } } // Check the contents of the interleaved array //for( int i = 0; i < g_numberVertices_Background; i++ ){ // cout << "VERTEX:\t" << i << endl; // cout << "POS:\tX:" << g_background[i].Position[0] << '\t' << g_background[i].Position[1] << '\t' << g_background[i].Position[2] << endl; // cout << "NORM:\tX:" << g_background[i].Normal[0] << '\t' << g_background[i].Normal[1] << '\t' << g_background[i].Normal[2] << endl; // cout << "COL:\tX:" << static_cast<GLfloat>(g_background[i].Color[0]) << '\t' << static_cast<GLfloat>(g_background[i].Color[1]) << '\t' << static_cast<GLfloat>(g_background[i].Color[2]) << endl; // cout << "TEX:\tX:" << g_background[i].TexCoord[0] << '\t' << g_background[i].TexCoord[1] << endl; // cout << endl; //} //Set the shaders setShaders("backgroundTexture.vs", "backgroundTexture.fs", &g_programHandle_Background, &g_vertexShaderHandle_Background, &g_fragmentShaderHandle_Background); // Get Attribute Locations g_vertexLocation_Background = glGetAttribLocation( g_programHandle_Background, "in_Position" ); g_colorLocation_Background = glGetAttribLocation( g_programHandle_Background, "in_Color" ); g_texCoordLocation_Background = glGetAttribLocation( g_programHandle_Background, "in_TexCoord" ); g_textureLocation_Background = glGetUniformLocation( g_programHandle_Background, "uImageUnit" ); glGenVertexArrays( 1, &g_vao[0]); glBindVertexArray( g_vao[0] ); // Generate and Fill the Buffers static GLsizei stride = sizeof( vertexStruct ); // INTERLEAVED ARRAYS // Position glGenBuffers(1, &g_verticesVBO_Background ); glBindBuffer( GL_ARRAY_BUFFER, g_verticesVBO_Background ); glBufferData( GL_ARRAY_BUFFER, sizeof(g_background), g_background, GL_STATIC_DRAW ); glEnableVertexAttribArray( g_vertexLocation_Background ); glVertexAttribPointer( g_vertexLocation_Background, // attribute DIM_POSITION, // number of elements per vertex GL_FLOAT, // type of each element GL_FALSE, // normalized? stride, // next vertex location appears every 3 floats (void*)offsetof( vertexStruct, Position ) // offset of the first element ); // Color glEnableVertexAttribArray( g_colorLocation_Background ); glVertexAttribPointer( g_colorLocation_Background, // attribute DIM_COLOR, // number of elements per vertex GL_UNSIGNED_BYTE, // type of each element GL_FALSE, // normalized? stride, // next vertex location appears every 3 floats (void*)offsetof( vertexStruct, Color ) // offset of the first element ); // Texture glEnableVertexAttribArray( g_texCoordLocation_Background ); glVertexAttribPointer( g_texCoordLocation_Background, // attribute DIM_TEXCOORD, // number of elements per vertex GL_FLOAT, // type of each element GL_FALSE, // normalized? stride, // next vertex location appears every 3 floats (void*)offsetof( vertexStruct, TexCoord ) // offset of the first element ); glGenBuffers( 1, &g_indicesVBO_Background ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, g_indicesVBO_Background ); glBufferData( GL_ELEMENT_ARRAY_BUFFER, SizeOfArray( indices ) * sizeof( GLuint ), indices, GL_STATIC_DRAW ); GLenum error=glGetError(); glBindVertexArray( 0 ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); //---------------------------------------------------------------------- // BEGIN Skeleton Shader Setup Code //---------------------------------------------------------------------- setShaders( "skeleton.vs", "skeleton.fs", &g_programHandle_Skeleton, &g_vertexShaderHandle_Skeleton, &g_fragmentShaderHandle_Skeleton ); //Get the attribute locations g_vertexLocation_Skeleton = glGetAttribLocation( g_programHandle_Skeleton, "in_Position" ); // Bind the buffers, fill with data, and attach to the program glGenVertexArrays( 1, &g_vao[1]); glBindVertexArray( g_vao[1] ); glGenBuffers( 1, &g_verticesVBO_Skeleton ); glBindBuffer( GL_ARRAY_BUFFER, g_verticesVBO_Skeleton ); glBufferData( GL_ARRAY_BUFFER, 3 * MAX_JOINTS * sizeof(GLfloat), NULL, GL_STREAM_DRAW ); glVertexAttribPointer( g_vertexLocation_Skeleton, 3, GL_FLOAT, 0, 0, 0 ); glEnableVertexAttribArray( g_vertexLocation_Skeleton ); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClearDepth( 1.0f ); glEnable( GL_DEPTH_TEST ); glEnable( GL_CULL_FACE ); glEnable( GL_VERTEX_PROGRAM_POINT_SIZE ); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); }
void SceneDrawer::DrawSkeletonWithShaders( XnUserID nUserId ) { XnUInt16 numJoints = MAX_JOINTS; // TODO: Write 3D function if( m_pUserTrackerObj->GetJoints( nUserId, pJointsPosArr, pConfidenceArr, numJoints ) != XN_STATUS_OK ) return; // no limbs to draw if( numJoints == 0 ) return; // no limbs to draw static GLfloat skeletonJoints[MAX_JOINTS][3]; for( XnUInt16 j = 0; j < MAX_JOINTS; j++ ){ skeletonJoints[j][0] = pJointsPosArr[j].X; skeletonJoints[j][1] = pJointsPosArr[j].Y; skeletonJoints[j][2] = pJointsPosArr[j].Z; //cout << j << '\t' << pJointsPosArr[j].X << '\t' << pJointsPosArr[j].Y << '\t' << pJointsPosArr[j].Z << endl; //cout << j << '\t' << skeletonJoints[j][0] << '\t' << skeletonJoints[j][1] << '\t' << skeletonJoints[j][2] << endl; } //cout << endl; // Designate the desired shader program glUseProgram( g_programHandle_Skeleton ); // Bind the buffers, fill with data, and attach to the program glBindVertexArray( g_vao[1] ); // Refill the array glBindBuffer( GL_ARRAY_BUFFER, g_verticesVBO_Skeleton ); glBufferSubData( GL_ARRAY_BUFFER, 0, 3 * MAX_JOINTS * sizeof(GLfloat), &skeletonJoints ); /* // Skeleton Array from UserTracker.cpp { XN_SKEL_HEAD, XN_SKEL_NECK }, { XN_SKEL_NECK, XN_SKEL_LEFT_SHOULDER }, { XN_SKEL_LEFT_SHOULDER, XN_SKEL_LEFT_ELBOW }, { XN_SKEL_LEFT_ELBOW, XN_SKEL_LEFT_HAND }, { XN_SKEL_NECK, XN_SKEL_RIGHT_SHOULDER }, { XN_SKEL_RIGHT_SHOULDER, XN_SKEL_RIGHT_ELBOW }, { XN_SKEL_RIGHT_ELBOW, XN_SKEL_RIGHT_HAND }, { XN_SKEL_LEFT_SHOULDER, XN_SKEL_TORSO }, { XN_SKEL_RIGHT_SHOULDER, XN_SKEL_TORSO }, { XN_SKEL_TORSO, XN_SKEL_LEFT_HIP }, { XN_SKEL_LEFT_HIP, XN_SKEL_LEFT_KNEE }, { XN_SKEL_LEFT_KNEE, XN_SKEL_LEFT_FOOT }, { XN_SKEL_TORSO, XN_SKEL_RIGHT_HIP }, { XN_SKEL_RIGHT_HIP, XN_SKEL_RIGHT_KNEE }, { XN_SKEL_RIGHT_KNEE, XN_SKEL_RIGHT_FOOT }, { XN_SKEL_LEFT_HIP, XN_SKEL_RIGHT_HIP }, */ static GLuint indices_Skeleton[] = { 0, 1, 1, 2, 2, 3, 3, 4, 1, 5, 5, 6, 6, 7, 2, 8, 5, 8, 8, 9, 9, 10, 10, 11, 8, 12, 12, 13, 13, 14, 9, 12 }; int numberIndices_Skeleton = SizeOfArray(indices_Skeleton); // **************************************** // Draw the geometry glDrawRangeElements( GL_LINES, // Type of Geometry 0, // Start index numberIndices_Skeleton, // End index numberIndices_Skeleton, // Count of indices GL_UNSIGNED_INT, // Type of index indices_Skeleton // Pointer to the indices ); glFlush(); // Return control to pipeline glUseProgram(0); glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindVertexArray( 0 ); }
/*---------------------------------------------------------------------------------------------- The hwnd has been attached. ----------------------------------------------------------------------------------------------*/ void HwMainWnd::PostAttach(void) { StrAppBuf strbT; // Holds temp string // Set the default caption text. strbT.Load(kstidHelloWorld); ::SendMessage(m_hwnd, WM_SETTEXT, 0, (LPARAM)strbT.Chars()); // This creates the main frame window and sets it as the current window. It also // creates the rebar and status bar. SuperClass::PostAttach(); const int rgrid[] = { kridTBarStd, kridHwTBarIns, kridHwTBarTools, kridHwTBarWnd, }; GetMenuMgr()->LoadToolBars(rgrid, SizeOfArray(rgrid)); // Create the menu bar. AfMenuBarPtr qmnbr; qmnbr.Create(); qmnbr->Initialize(m_hwnd, kridAppMenu, kridAppMenu, "Menu Bar"); m_vqtlbr.Push(qmnbr.Ptr()); // Create the toolbars. AfToolBarPtr qtlbr; qtlbr.Create(); qtlbr->Initialize(kridTBarStd, kridTBarStd, "Standard"); m_vqtlbr.Push(qtlbr); qtlbr.Create(); qtlbr->Initialize(kridHwTBarIns, kridHwTBarIns, "Insert"); m_vqtlbr.Push(qtlbr); qtlbr.Create(); qtlbr->Initialize(kridHwTBarTools, kridHwTBarTools, "Tools"); m_vqtlbr.Push(qtlbr); qtlbr.Create(); qtlbr->Initialize(kridHwTBarWnd, kridHwTBarWnd, "Window"); m_vqtlbr.Push(qtlbr); // Load window settings. LoadSettings(NULL, false); g_app.AddCmdHandler(this, 1); m_qstbr->RestoreStatusText(); // Create the client window. const int kwidChild = 1000; WndCreateStruct wcs; wcs.InitChild("STATIC", m_hwnd, kwidChild); m_qwndHost.Create(); m_qwndHost->CreateAndSubclassHwnd(wcs); Assert(memcmp(&CLSID_SaCtrlEvent, &DIID__DSAEvents, isizeof(GUID)) == 0); CComCoClass<SaCtrlEvent>::CreateInstance(&m_qsce); IUnknownPtr qunk; CheckHr(AtlAxCreateControlEx(L"SA.SACtrl.1", m_qwndHost->Hwnd(), NULL, NULL, &qunk, DIID__DSAEvents, (IUnknown *)m_qsce.Ptr())); CheckHr(qunk->QueryInterface(DIID__DSA, (void **)&m_qctrl)); m_qsce->Init(this, m_qctrl); StrUni stu(L"baluchi.wav"); CheckHr(m_qctrl->put_WaveFile(stu.Bstr())); CheckHr(m_qctrl->raw_SetGraphs(GRAPH_MAGNITUDE, GRAPH_MAGNITUDE)); CheckHr(m_qctrl->put_ShowContextMenu(false)); CheckHr(m_qctrl->put_ShowCursorContextMenu(false)); ::ShowWindow(m_qwndHost->Hwnd(), SW_SHOW); g_app.AddCmdHandler(this, 1); }
bool CKLBUIScore::initCore(u32 order, s32 order_offset, float x, float y, const char ** tex_table, float stepX, float stepY, int column, bool fillzero, bool anim_flag, u32 align, bool countclip) { if(!setupPropertyList((const char**)ms_propItems,SizeOfArray(ms_propItems))) { return false; } setInitPos(x, y); m_order = order; m_orderOffset = order_offset; m_stepX = (int)stepX; m_stepY = (int)stepY; m_column = column; m_bFillZero = fillzero; m_anim = anim_flag; m_align = align; m_bCountClip = countclip; m_dotStepX = 0; m_dotStepY = 0; m_value = 0xFFFFFFFF; m_fValue = -12345678.0f; setValue(0); setValueFloat(0.0f, 0); RESET_B; // Reset flag done by setValueFloat. // align設定用の幅を計算 m_width = stepX * column; m_height = stepY * column; // 保持できる最大値+1を計算 m_maxvalue = 1; for(int i = 0; i < column; i++) { m_maxvalue = m_maxvalue * 10; } for(int idx = 0; idx < 10; idx++) { setStrC(m_asset[idx], tex_table[idx]); } CKLBTextureAsset * pTexAsset; pTexAsset = (CKLBTextureAsset *)CKLBUtility::loadAssetScript( m_asset[0], &m_handle, NULL, true); const char * texname[10]; for(int i = 0; i < 10; i++) { texname[i] = m_asset[i] + 8; } m_pScoreNode = KLBNEW(CKLBScoreNode); if(!m_pScoreNode) { CKLBDataHandler::releaseHandle(m_handle); return false; } for(int i = 0; i < 10; i++) { m_numTex[i] = pTexAsset->getImage(texname[i]); if(m_numTex[i] == 0) { CKLBScriptEnv::getInstance().error("TEXB differs from [%s] by [%s].", texname[0], texname[i]); CKLBDataHandler::releaseHandle(m_handle); return false; } } bool bResult = m_pScoreNode->init( order, order_offset, m_numTex, m_stepX, m_stepY, column, fillzero, anim_flag); getNode()->addNode(m_pScoreNode, 0); m_pScoreNode->markUpMatrix(); m_bScoreUpdate = true; if(!bResult) CKLBDataHandler::releaseHandle(m_handle); return bResult; }
/*---------------------------------------------------------------------------------------------- Returns the number of ColorDefn's in the table. ----------------------------------------------------------------------------------------------*/ int ColorTable::Size() { return SizeOfArray(s_rgcdn); }