| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "embedders/openglui/emulator/emulator_graphics_handler.h" | 5 #include "embedders/openglui/emulator/emulator_graphics_handler.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 EmulatorGraphicsHandler::EmulatorGraphicsHandler(int argc, | 10 EmulatorGraphicsHandler::EmulatorGraphicsHandler(int argc, |
| 11 char** argv) | 11 char** argv) |
| 12 : GLGraphicsHandler() { | 12 : GraphicsHandler() { |
| 13 glutInit(&argc, argv); | 13 glutInit(&argc, argv); |
| 14 width_ = 480; | 14 SetViewport(0, 0, 480, 800); |
| 15 height_ = 800; | |
| 16 for (int i = 1; i < argc; i++) { | 15 for (int i = 1; i < argc; i++) { |
| 17 if (argv[i][0] == '-') { | 16 if (argv[i][0] == '-') { |
| 18 int next_arg = i + 1; | 17 int next_arg = i + 1; |
| 19 if (next_arg < argc && strcmp(argv[i], "-w") == 0) { | 18 if (next_arg < argc && strcmp(argv[i], "-w") == 0) { |
| 20 width_ = static_cast<size_t>(atoi(argv[i = next_arg])); | 19 width_ = static_cast<size_t>(atoi(argv[i = next_arg])); |
| 21 } else if (next_arg < argc && strcmp(argv[i], "-h") == 0) { | 20 } else if (next_arg < argc && strcmp(argv[i], "-h") == 0) { |
| 22 height_ = static_cast<size_t>(atoi(argv[i = next_arg])); | 21 height_ = static_cast<size_t>(atoi(argv[i = next_arg])); |
| 23 } | 22 } |
| 24 } | 23 } |
| 25 } | 24 } |
| 25 glutInitWindowSize(width_, height_); |
| 26 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL); |
| 27 glutCreateWindow("Dart"); |
| 26 } | 28 } |
| 27 | 29 |
| 28 int32_t EmulatorGraphicsHandler::Start() { | 30 int32_t EmulatorGraphicsHandler::Start() { |
| 29 glutInitWindowSize(width_, height_); | 31 return GraphicsHandler::Start(); |
| 30 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); | |
| 31 glutCreateWindow("Dart"); | |
| 32 return 0; | |
| 33 } | 32 } |
| 34 | 33 |
| 35 void EmulatorGraphicsHandler::Stop() { | 34 void EmulatorGraphicsHandler::Stop() { |
| 35 GraphicsHandler::Stop(); |
| 36 exit(0); | 36 exit(0); |
| 37 } | 37 } |
| 38 | 38 |
| OLD | NEW |