Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: examples/pong/pong.cc

Issue 7982038: Merge in r1190 (add pong). (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/branches/trout/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « examples/pong/pong.h ('k') | examples/pong/pong.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « examples/pong/pong.h ('k') | examples/pong/pong.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698