Desktop applications written in php. Copy the PHP content to the clipboard. PHP code :? Php $ winmainwb_create_window (null, AppWindow, game, WBC_CENTER, WBC_CENTER, 800,495,); wb_create_control ($ winmain, Label, banker, 20, 1 copy the PHP content to the PHP clipboard code:
$ Winmain = wb_create_window (null, AppWindow, 'point 21 game', WBC_CENTER, WBC_CENTER, 800,495 );
Wb_create_control ($ winmain, Label, 'banker ', 20, 15, 40, 30, LB_1, 0, 0 );
Wb_create_control ($ winmain, Label, 'gamer ', 20,200, LB_2, 0 );
Wb_create_control ($ winmain, Frame, '', 120,150, FR_PC_1, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 120,150, FR_PC_2, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 36120,150, FR_PC_3, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 120,150, 40, FR_PC_4, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 640,40, 120,150, FR_PC_5, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 645,230,120,150, FR_U_5, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 500,230,120,150, FR_U_4, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 360,230,120,150, FR_U_3, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 220,230,120,150, FR_U_2, 0, 0 );
Wb_create_control ($ winmain, Frame, '', 80,230,120,150, FR_U_1, 0, 0 );
Wb_create_control ($ winmain, Label, '', 35,305, LB_U_T, 0 );
Wb_create_control ($ winmain, Label, '', 35,110, LB_P_T, 0 );
Wb_create_control ($ winmain, PushButton, 'licensing ', 320,400, B _GO, 0 x, 0 );
Wb_create_control ($ winmain, PushButton, 'stop', 435,400, B _CHANGE, 0 x, 0 );
Wb_create_control ($ winmain, Label, '', 110,95, 60,60, LB_PC_1, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 95, 60, 60, LB_PC_2, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 390,95, 60,60, LB_PC_3, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 530,95, 60,60, LB_PC_4, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 670,95, 60, 60, LB_PC_5, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 110,285, 60, 60, LB_U_1, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 250,285, 60, 60, LB_U_2, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 390,285, 60, 60, LB_U_3, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 530,285, 60, 60, LB_U_4, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 670,285, 60, 60, LB_U_5, 0x00000800,0, 0 );
Wb_create_control ($ winmain, Label, '', 90, 20, PC_MON, 0 );
Wb_create_control ($ winmain, Label, '', 70,205, 90,20, U_MON, 0 );
Point_shortde.php file
For ($ I = 1; $ I <= 13; $ I ++ ){
Switch ($ I ){
Case 1j = 1; $ key = 'a'; break;
Case 11j = 10; $ key = 'J'; break;
Case 12j = 10; $ key = 'q'; break;
Case 13j = 10; $ key = 'K'; break;
Default:
$ Key = $ j = $ I;
}
$ Card [" \ n peach \ n $ key"] = $ j;
$ Card ["Red \ n peach \ n $ key"] = $ j;
$ Card ["Mei \ n flowers \ n $ key"] = $ j;
$ Card ["square \ n slices \ n $ key"] = $ j;
}
$ Contorl_id = array (
'B _ go' => 1001,' B _ change' => 1002,
'Me _ start' => 2001, 'Me _ REMON '=> 2002, 'Me _ AUTHOR' => 2003, 'Me _ QUIT '=> IDCLOSE,
'LB _ 1' => 3001, 'LB _ 2' => 3002, 'LB _ U_T '=> 3003, 'LB _ P_T' => 3004,
'PC _ MON' => 3005, 'U _ MON' => 3006,
'LB _ PC_1 '=> 3101, 'LB _ PC_2' => 3102, 'LB _ PC_3 '=> 3103, 'LB _ PC_4' => 3104, 'LB _ PC_5 '=> 3105,
'LB _ U_1 '=> 3201, 'LB _ U_2' => 3202, 'LB _ U_3 '=> 3203, 'LB _ U_4' => 3204, 'LB _ U_5 '=> 3205,
'Fr _ PC_1 '=> 4001, 'Fr _ PC_2' => 4002, 'Fr _ PC_3 '=> 4003, 'Fr _ PC_4' => 4004, 'Fr _ PC_5 '=> 4005,
'Fr _ U_1 '=> 5001, 'Fr _ U_2' => 5002, 'Fr _ U_3 '=> 5003, 'Fr _ U_4' => 5004, 'Fr _ U_5 '=> 5005,
);
Foreach ($ contorl_id as $ key => $ value ){
If (! Defined (strtoupper ($ key) define (strtoupper ($ key), $ value );
}
?>
21point. phpw file
Set_time_limit (0 );
Include_once ('include/winbinder. php ');
Include_once ('form/point_include.php ');
Include_once ('form/21point. form. php ');
Class Ponit {
Public $ key_id;
Private $ user_point = 10000;
Private $ pc_point = 10000;
Private $ card;
Private $ player = 'user ';
Private $ new_term = false;
Private $ remon = false;
Public function _ construct ($ winmain, $ card ){
$ F = file_get_contents ('form/db. db ');
List ($ this-> user_point, $ this-> pc_point) = explode ('|', $ f );
$ This-> window = $ winmain;
$ This-> card = $ card;
$ This-> prepare ();
}
Private function prepare (){
Wb_set_image ($ this-> window, 'form/hyper. ico ');
Wb_create_control ($ this-> window, Menu, array (
'Game (& G) ', null,
Array (ME_START, "\ tCrtl + N", '','', 'Ctrl + N '),
Array (ME_REMON, "scoring "),
Array (ME_AUTHOR, "author "),
Null,
Array (ME_QUIT, "exit \ tCrtl + Q", '','', 'Ctrl + Q '),
Null
));
Wb_set_text (wb_get_control ($ this-> window, U_MON), $ this-> user_point. 'quantity ');
Wb_set_text (wb_get_control ($ this-> window, PC_MON), $ this-> pc_point. 'quantity ');
$ Font = wb_create_font ("Arial", 13, null, FTA_BOLD );
Wb_set_font (wb_get_control ($ this-> window, LB_1), $ font );
Wb_set_font (wb_get_control ($ this-> window, LB_2), $ font );
$ Font = wb_create_font ("Arial", 34, null, FTA_BOLD );
For ($ I = 1; $ I <= 5; $ I ++ ){
Wb_set_font (wb_get_control ($ this-> window, (3100 + $ I), $ font );
Wb_set_font (wb_get_control ($ this-> window, (3200 + $ I), $ font );
}
}
Private function start (){
$ This-> player = 'user ';
$ This-> new_term = true;
$ This-> clear ();
$ This-> play ();
Wb_set_enabled (wb_get_control ($ this-> window, B _GO), true );
Wb_set_enabled (wb_get_control ($ this-> window, B _CHANGE), true );
}
Private function stop (){
Wb_set_enabled (wb_get_control ($ this-> window, B _GO), false );
Wb_set_enabled (wb_get_control ($ this-> window, B _CHANGE), false );
}
Private function change_player (){
$ This-> stop ();
$ This-> player = 'PC ';
$ This-> play ();
}
Private function total ($ num = 0, $ win ){
Static $ u_tem, $ p_tem;
If (empty ($ u_tem) | empty ($ p_tem) | $ this-> remon = true ){
$ U_tem = $ this-> user_point;
$ P_tem = $ this-> pc_point;
$ This-> remon = false;
}
If (strtoupper ($ win) = 'u '){
$ U_tem + = $ num;
$ P_tem-= $ num;
} Else {
$ U_tem-= $ num;
$ P_tem + = $ num;
}
$ This-> user_point = $ u_tem;
$ This-> pc_point = $ p_tem;
Wb_set_text (wb_get_control ($ this-> window, U_MON), $ this-> user_point. 'quantity ');
Wb_set_text (wb_get_control ($ this-> window, PC_MON), $ this-> pc_point. 'quantity ');
$ F = fopen ('form/db. db', 'wb ');
Fwrite ($ f, $ this-> user_point. "|". $ this-> pc_point );
Fclose ($ f );
}
Private function remon (){
$ This-> remon = true;
$ This-> user_point = 10000;
$ This-> pc_point = 10000;
Wb_set_text (wb_get_control ($ this-> window, U_MON), $ this-> user_point. 'quantity ');
Wb_set_text (wb_get_control ($ this-> window, PC_MON), $ this-> pc_point. 'quantity ');
$ F = fopen ('form/db. db', 'wb ');
Fwrite ($ f, $ this-> user_point. "|". $ this-> pc_point );
Fclose ($ f );
}
Private function clear (){
Wb_set_text (wb_get_control ($ this-> window, LB_U_T ),'');
Wb_set_text (wb_get_control ($ this-> window, LB_P_T ),'');
For ($ I = 1; $ I <= 5; $ I ++ ){
Wb_set_text (wb_get_control ($ this-> window, (4000 + $ I )),'');
Wb_set_text (wb_get_control ($ this-> window, (5000 + $ I )),'');
Wb_set_text (wb_get_control ($ this-> window, (3100 + $ I )),'');
Wb_set_text (wb_get_control ($ this-> window, (3200 + $ I )),'');
}
}
Private function play (){
Static $ card_tem = array (), $ I = 0, $ j = 0, $ user_total = 0, $ pc_total = 0;
If ($ this-> new_term = true ){
$ Card_tem = $ this-> card;
$ This-> new_term = false;
$ User_total = 0;
$ Pc_total = 0;
$ I = 0; $ j = 0;
}
If ($ this-> player = 'user '){
$ I ++;
$ Card_key = array_rand ($ card_tem );
$ Card_value = $ card_tem [$ card_key];
$ User_total + = $ card_value;
Wb_set_text (wb_get_control ($ this-> window, LB_U_T), $ user_total. 'point ');
Wb_set_text (wb_get_control ($ this-> window, (5000 + $ I), $ card_key );
Wb_set_text (wb_get_control ($ this-> window, (3200 + $ I), $ card_value );
If ($ I> = 5 & $ user_total <= 21 ){
$ This-> total (20, 'u ');
$ Sel = wb_message_box ($ this-> window, "Congratulations, five small players, winning! \ N do you want to continue? ", 'Shengli ', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
} Elseif ($ user_total> 21 ){
$ This-> total (20, 'P ');
$ Sel = wb_message_box ($ this-> window, "Unfortunately, the banker wins! \ N do you want to continue? ", 'Failed', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
}
} Else {
$ J ++;
$ Card_key = array_rand ($ card_tem );
$ Card_value = $ card_tem [$ card_key];
$ Pc_total + = $ card_value;
Wb_set_text (wb_get_control ($ this-> window, LB_P_T), $ pc_total. 'point ');
Wb_set_text (wb_get_control ($ this-> window, (4000 + $ j), $ card_key );
Wb_set_text (wb_get_control ($ this-> window, (3100 + $ j), $ card_value );
If ($ j> = 5 & $ pc_total <= 21 ){
$ This-> total (20, 'P ');
$ Sel = wb_message_box ($ this-> window, "the banker has five pictures, and the banker wins! \ N do you want to continue? ", 'Failed', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
} Elseif ($ pc_total> 21 ){
If ($ pc_total-$ card_value <$ user_total ){
$ This-> total (20, 'u ');
$ Sel = wb_message_box ($ this-> window, "Congratulations, the number of banker points exceeds 21 and the player wins! \ N do you want to continue? ", 'Shengli ', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
} Else {
$ Pc_total = $ pc_total-$ card_value;
Wb_set_text (wb_get_control ($ this-> window, LB_P_T), $ pc_total. 'point ');
Wb_set_text (wb_get_control ($ this-> window, (4000 + $ j )),'');
Wb_set_text (wb_get_control ($ this-> window, (3100 + $ j )),'');
If ($ pc_total >=$ user_total ){
$ This-> total (20, 'P ');
$ Msg = ($ pc_total = $ user_total )? "The Banker wins the same number of points on both sides! \ N do you want to continue? ":" The banker points are bigger than you, and the crops win! \ N do you want to continue? ";
$ Sel = wb_message_box ($ this-> window, $ msg, 'failed', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
} Else {
$ This-> total (20, 'u ');
$ Sel = wb_message_box ($ this-> window, "Congratulations, the banker points are smaller than you, and the player wins! \ N do you want to continue? ", 'Shengli ', WBC_YESNO );
$ Sel = 1? $ This-> start (): $ this-> stop ();
}
}
} Else {
Usleep (800000 );
$ This-> play ();
}
}
Unset ($ card_tem [$ card_key]);
}
Private function author (){
$ Inf = "Hello everyone, I'm a machine _ horse, \ n. This is the first desktop application in my life. \ n is a bad job. everyone laughed, hahaha ^_^. \ N \ t author: machine _ horse ";
$ Author_window = wb_create_window ($ this-> window, ModalDialog, 'author profile ', WBC_CENTER, WBC_CENTER, 360,180, 0x00000000, 0 );
Wb_set_handler ($ author_window, 'author _ handler ');
$ Image = wb_create_control ($ author_window, Frame, '000000', 123, 128,144,110, WBC_IMAGE );
Wb_create_control ($ author_window, Label, $ inf, 200,150,120, WBC_IMAGE );
Wb_set_image ($ image, 'form/author.bmp ', NOCOLOR );
}
Public function main (){
Switch ($ this-> key_id ){
Case IDCLOSE:
Wb_destroy_window ($ this-> window); break;
Case ME_START:
$ This-> start (); break;
Case ME_AUTHOR:
$ This-> author (); break;
Case B _GO:
$ This-> play (); break;
Case B _CHANGE:
$ This-> change_player (); break;
Case ME_REMON:
$ This-> remon (); break;
}
}
}
$ Wbd = new Ponit ($ winmain, $ card );
Wb_set_handler ($ winmain, 'Go _ ');
Wb_main_loop ();
Function go_to ($ window, $ id ){
Global $ wbd;
$ Wbd-> key_id = $ id;
Return $ wbd-> main ();
}
Function author_handler ($ this_window, $ id ){
Switch ($ id ){
Case IDCLOSE:
Wb_destroy_window ($ this_window );
}
}
?>
Why :? Php $ winmain = wb_create_window (null, AppWindow, '21 point game', WBC_CENTER, WBC_CENTER, 800,495,); wb_create_control ($ winmain, Label, 'banker ', 20, 1...