Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "vr_ui.h" |
| 18 | |
| 19 | #include <minui/minui.h> |
| 20 | |
Luke Song | 9d4839c | 2017-06-23 14:33:46 -0700 | [diff] [blame] | 21 | VrRecoveryUI::VrRecoveryUI() : kStereoOffset(RECOVERY_UI_VR_STEREO_OFFSET) {} |
Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 22 | |
| 23 | bool VrRecoveryUI::InitTextParams() { |
Luke Song | 9d4839c | 2017-06-23 14:33:46 -0700 | [diff] [blame] | 24 | if (!ScreenRecoveryUI::InitTextParams()) return false; |
Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 25 | int mid_divide = gr_fb_width() / 2; |
Luke Song | 9d4839c | 2017-06-23 14:33:46 -0700 | [diff] [blame] | 26 | text_cols_ = (mid_divide - kMarginWidth - kStereoOffset) / char_width_; |
Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 27 | return true; |
| 28 | } |
| 29 | |
Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 30 | void VrRecoveryUI::DrawTextLine(int x, int* y, const char* line, bool bold) const { |
| 31 | int mid_divide = gr_fb_width() / 2; |
Luke Song | 9d4839c | 2017-06-23 14:33:46 -0700 | [diff] [blame] | 32 | gr_text(gr_sys_font(), x + kStereoOffset, *y, line, bold); |
| 33 | gr_text(gr_sys_font(), x - kStereoOffset + mid_divide, *y, line, bold); |
Luke Song | e2bd876 | 2017-06-12 16:08:33 -0700 | [diff] [blame] | 34 | *y += char_height_ + 4; |
| 35 | } |