| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "examples/pong/pong.h" | 5 #include "examples/pong/pong.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include "examples/pong/view.h" | 10 #include "examples/pong/view.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 return; // Since we cant't save the score to file, do nothing and return. | 405 return; // Since we cant't save the score to file, do nothing and return. |
| 406 size_t message_length = 18 + (player_score_ ? log(player_score_) : 1) + 1 | 406 size_t message_length = 18 + (player_score_ ? log(player_score_) : 1) + 1 |
| 407 + (computer_score_ ? log(computer_score_) : 1) + 1; | 407 + (computer_score_ ? log(computer_score_) : 1) + 1; |
| 408 std::string score_message(message_length, '\0'); | 408 std::string score_message(message_length, '\0'); |
| 409 snprintf(&score_message[0], score_message.length(), | 409 snprintf(&score_message[0], score_message.length(), |
| 410 "You: %i Computer: %i", player_score_, computer_score_); | 410 "You: %i Computer: %i", player_score_, computer_score_); |
| 411 PostMessage(pp::Var(score_message)); | 411 PostMessage(pp::Var(score_message)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace pong | 414 } // namespace pong |
| OLD | NEW |