Presentation is loading. Please wait.

Presentation is loading. Please wait.

33% Multi-screened while gaming 1 6 v.

Similar presentations


Presentation on theme: "33% Multi-screened while gaming 1 6 v."— Presentation transcript:

1

2

3

4 33% Multi-screened while gaming 1

5

6 6

7

8 v

9

10

11

12

13

14

15

16

17

18

19

20

21 21 // Initialize Xbox SmartGlass if( FAILED( XbcInitialize(XbcReceiveCallback, NULL) ) ) return; InitTime(); g_pPokerGame->ShuffleCards(); for(;;) // loop forever { // What time is it? UpdateTime(); // Check for messages XbcDoWork(); // Update the world UpdateTexCoords(); // Render the scene Render(); }

22 //-------------------------------------------------------------------------------------- // Name: XbcReceiveCallback // Desc: Callback function for Xbc events, such as client connect/disconnect and // title messaging. When we call XbcDoWork, if messages have come in, they will // use this callback for our app to receive them //-------------------------------------------------------------------------------------- VOID XbcReceiveCallback( HRESULT hr, PXBC_EVENT_PARAMS pParams, VOID* pvState ) { switch ( pParams->Type ) { case XBC_EVENT_CLIENT_CONNECTED: { // Add the player to the game and post the message to the screen PokerPlayer* pPlayer = new PokerPlayer( pParams->nClientId ); INT iPlayerIndex = -1; if ( SUCCEEDED( g_pPokerGame->AddPlayer(pPlayer, &iPlayerIndex))) { RtlZeroMemory( g_wstrMessage, sizeof( g_wstrMessage ) ); std::wstringstream wss; // Convert the number from 0-based to 1-based for readability wss << "Player " << (iPlayerIndex + 1) << " connected!"; wcsncpy_s(g_wstrMessage, wss.str().c_str(), 20); } } break;...

23 23 case Json_FieldName: RtlZeroMemory(&buffer, sizeof(buffer)); XJSONGetTokenValue( hReader, buffer, ARRAYSIZE( buffer ) ); buffer[nTokenLength] = L'\0'; switch( tokenType ) { case Json_String: if ( next == ACTION ) { next = NONE; if (wcsncmp( (const wchar_t *)buffer, L"fold", 4 ) == 0 ) { g_pPokerGame->PlayerFold( pParams->nClientId ); } else if ( wcsncmp( (const wchar_t *)buffer, L"join", 4) == 0 ) { g_pPokerGame->PlayerJoin( pParams->nClientId ); } else if ( wcsncmp( (const wchar_t *)buffer, L"start", 5 ) == 0 ) { g_pPokerGame->StartGame(); } else if ( wcsncmp( (const wchar_t *)buffer, L"getstate", 8) == 0 ) { if ( g_pPokerGame->IsGameStarted() ) { g_pPokerGame->SendPlayerState( pParams->nClientId ); } } } break;

24 24 Xbc.on("loaded", function (loadedData) { Xbc.Messaging.sendMessage({ action: Poker.Action.GETSTATE }); $("#join_button").click(function () { Xbc.Messaging.sendMessage({ action: Poker.Action.JOIN }); }); $("#start_button").click(function () { Xbc.Messaging.sendMessage({ action: Poker.Action.START }); }); $("#chip_count").text(money); $("#call_check_button").click(function () { if ($("#call_check_button").text() === "Check") { performCheck(); } else { performCall(); } }); $("#fold_button").click(function () { // Submit a fold performFold(); }); $("#bet_button").click(function () { performBet(); });

25 25 Xbc.on("accelerometer", function (value) { // We're assuming that an acceleration vector length greater than KNOCK_ACCEL_CUTOFF // Is a "table-knock" check // Calculate acceleration vector length var xVal = parseInt(value.x, 10); var yVal = parseInt(value.y, 10); var zVal = parseInt(value.z, 10); var vecLength = Math.sqrt(xVal * xVal + yVal * yVal + zVal * zVal); if (vecLength > KNOCK_ACCEL_CUTOFF) { performCheck(); } });

26

27

28


Download ppt "33% Multi-screened while gaming 1 6 v."

Similar presentations


Ads by Google