MCPcopy Create free account
hub / github.com/Voine/ChatWaifu_Mobile / InitializeSprite

Method InitializeSprite

Live2D/src/main/cpp/LAppView.cpp:112–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void LAppView::InitializeSprite()
113{
114 int width = LAppDelegate::GetInstance()->GetWindowWidth();
115 int height = LAppDelegate::GetInstance()->GetWindowHeight();
116
117 LAppTextureManager* textureManager = LAppDelegate::GetInstance()->GetTextureManager();
118 const string resourcesPath = ResourcesPath;
119
120 string imageName = BackImageName;
121 LAppTextureManager::TextureInfo* backgroundTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
122
123 float x = width * 0.5f;
124 float y = height * 0.5f;
125 float fWidth = width;
126 float fHeight = height;
127
128 if(_back == NULL)
129 {
130 _back = new LAppSprite(x, y, fWidth, fHeight, backgroundTexture->id, _programId);
131 }
132 else
133 {
134 _back->ReSize(x, y, fWidth, fHeight);
135 }
136
137
138 imageName = GearImageName;
139 LAppTextureManager::TextureInfo* gearTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
140
141 x = (width - gearTexture->width * 0.5f - 96.f);
142 y = (height - gearTexture->height * 0.5f);
143 fWidth = static_cast<float>(gearTexture->width);
144 fHeight = static_cast<float>(gearTexture->height);
145
146 if(_gear == NULL)
147 {
148 _gear = new LAppSprite(x, y, fWidth, fHeight, gearTexture->id, _programId);
149 }
150 else
151 {
152 _gear->ReSize(x, y, fWidth, fHeight);
153 }
154
155 imageName = PowerImageName;
156 LAppTextureManager::TextureInfo* powerTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
157
158 x = (width - powerTexture->width * 0.5f - 96.f);
159 y = (powerTexture->height * 0.5f);
160 fWidth = static_cast<float>(powerTexture->width);
161 fHeight = static_cast<float>(powerTexture->height);
162
163 if(_power == NULL)
164 {
165 _power = new LAppSprite(x, y, fWidth, fHeight, powerTexture->id, _programId);
166 }
167 else
168 {
169 _power->ReSize(x, y, fWidth, fHeight);

Callers 1

OnSurfaceChangedMethod · 0.80

Calls 5

GetWindowWidthMethod · 0.80
GetWindowHeightMethod · 0.80
GetTextureManagerMethod · 0.80
ReSizeMethod · 0.80

Tested by

no test coverage detected