| 146 | -------------------------------------------------------------------------------*/ |
| 147 | |
| 148 | void Player::BookGUI_t::updateBookGUI() |
| 149 | { |
| 150 | if ( !bookFrame ) |
| 151 | { |
| 152 | createBookGUI(); |
| 153 | } |
| 154 | |
| 155 | bookFrame->setSize(SDL_Rect{ players[player.playernum]->camera_virtualx1(), |
| 156 | players[player.playernum]->camera_virtualy1(), |
| 157 | players[player.playernum]->camera_virtualWidth(), |
| 158 | players[player.playernum]->camera_virtualHeight() }); |
| 159 | |
| 160 | bool errorOpening = false; |
| 161 | int bookIndex = getBook(openBookName); |
| 162 | if ( !allBooks.empty() && allBooks.size() >= bookIndex ) |
| 163 | { |
| 164 | if ( getBookDefaultNameFromIndex(bookIndex) != openBookName ) |
| 165 | { |
| 166 | errorOpening = true; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | if ( !inputs.getVirtualMouse(player.playernum)->draw_cursor |
| 171 | && player.GUI.activeModule != player.GUI.MODULE_BOOK_VIEW ) |
| 172 | { |
| 173 | bBookOpen = false; |
| 174 | } |
| 175 | |
| 176 | if ( !bBookOpen || allBooks.empty() || errorOpening ) |
| 177 | { |
| 178 | bookFrame->setDisabled(true); |
| 179 | bBookOpen = false; |
| 180 | openBookName = ""; |
| 181 | |
| 182 | auto innerFrame = bookFrame->findFrame("book frame"); |
| 183 | SDL_Rect pos = innerFrame->getSize(); |
| 184 | bookFadeInAnimationY = 0.0; |
| 185 | pos.y = -pos.h; |
| 186 | innerFrame->setSize(pos); |
| 187 | |
| 188 | auto fade = bookFrame->findImage("fade img"); |
| 189 | Uint8 r, g, b, a; |
| 190 | getColor(fade->color, &r, &g, &b, &a); |
| 191 | a = 0; |
| 192 | fade->color = makeColor( r, g, b, a); |
| 193 | return; |
| 194 | } |
| 195 | |
| 196 | bookFrame->setDisabled(false); |
| 197 | bookFrame->setSize(SDL_Rect{ players[player.playernum]->camera_virtualx1(), |
| 198 | players[player.playernum]->camera_virtualy1(), |
| 199 | players[player.playernum]->camera_virtualWidth(), |
| 200 | players[player.playernum]->camera_virtualHeight() }); |
| 201 | |
| 202 | auto innerFrame = bookFrame->findFrame("book frame"); |
| 203 | SDL_Rect bookSize = innerFrame->getSize(); |
| 204 | bookSize.x = bookFrame->getSize().w / 2 - bookSize.w / 2; |
| 205 |
no test coverage detected