c:\fwh\samples\poker\poker.prg

c:\fwh\samples\poker\poker.prg

Postby Jimmy » Thu Dec 05, 2019 11:51 pm

hi

next Sample where i got Error :(
Application
===========
Path and name: c:\fwh\samples\poker\poker.exe (32 bits)
Size: 3,999,232 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 19.06
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 5 mins 29 secs
Error occurred at: 12/06/19, 00:37:32
Error description: Error FiveWin/3 Cannot create Dialog Box:
Resource: Blatt

Stack Calls
===========
Called from: .\source\classes\DIALOG.PRG => CREATEDLGERROR( 717 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 306 )
Called from: poker.prg => POKER( 107 )


Question : are those "card1.bmp" in po.dll :?:

which Build*.BAT have to be use for that Sample :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby Silvio.Falconi » Fri Dec 06, 2019 10:05 am

you can use cards.dll of windows system there are on oldest windows xp
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Sat Dec 07, 2019 6:42 am

Silvio.Falconi wrote:you can use cards.dll of windows system there are on oldest windows xp

thx for Tip.
Yes it accept Cards.dll but still get a Error
Application
===========
Path and name: C:\fwh\samples\poker\poker.exe (32 bits)
Size: 4,086,272 bytes
Compiler version: Harbour 3.2.0dev (r1904111533)
FiveWin version: FWH 19.06
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 41 secs
Error occurred at: 12/07/19, 07:36:50
Error description: Error FiveWin/3 Cannot create Dialog Box:
Resource: Blatt

Stack Calls
===========
Called from: .\source\classes\DIALOG.PRG => CREATEDLGERROR( 717 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 306 )
Called from: C:\FWH\SAMPLES\POKER\poker.prg => POKER( 108 )

it must not be that Sample. i just like to know how to load Resource from e.g. Cards.DLL
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby Silvio.Falconi » Sat Dec 07, 2019 8:58 am

I'mafraid you must change the res
Code: Select all  Expand view
LANGUAGE 16, SUBLANG_DEFAULT
1 DIALOG 18, 18, 327, 210
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "P O K  E R"
FONT 10, "Arial"
{
    CONTROL         "", 121, "TBitmap", 0x50000000, 12, 64, 44, 58, 0x00000000
    CONTROL         "", 122, "TBitmap", 0x50000000, 75, 64, 44, 58, 0x00000000
    CONTROL         "", 123, "TBitmap", 0x50000000, 143, 64, 44, 58, 0x00000000
    CONTROL         "", 124, "TBitmap", 0x50000000, 209, 63, 44, 58, 0x00000000
    CONTROL         "", 125, "TBitmap", 0x50000000, 274, 63, 44, 58, 0x00000000
    PUSHBUTTON      "&Geben", 201, 25, 146, 60, 14, 0, WS_EX_LEFT
    PUSHBUTTON      "&Ziehen", 202, 106, 146, 60, 14, 0, WS_EX_LEFT
    PUSHBUTTON      "&Beenden", 203, 195, 146, 60, 14, 0, WS_EX_LEFT
    EDITTEXT        301, 101, 175, 34, 12, 0, WS_EX_LEFT
    LTEXT           "Einsatz:", 65535, 66, 177, 34, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Text", 65535, 378, 4294967248, 16, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Buben-Paar oder besser", 65535, 10, 10, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Zwei Paare", 65535, 10, 20, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Drei Gleiche", 65535, 10, 30, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Flash  (Farbe)", 65535, 10, 40, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  2  zu  1", 65535, 95, 10, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  3  zu  1", 65535, 95, 20, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  5  zu  1", 65535, 95, 30, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "20  zu  1", 65535, 95, 40, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Full House", 65535, 196, 11, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Vier Gleiche", 65535, 196, 21, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Farbstraße", 65535, 196, 31, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Royal Flash", 65535, 196, 41, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           " 50  zu  1", 65535, 281, 11, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "100  zu  1", 65535, 281, 21, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "200  zu  1", 65535, 281, 31, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "500  zu  1", 65535, 281, 41, 32, 8, SS_LEFT, WS_EX_LEFT
}


 


or as I made many years ago ... write all dialog on source @x,y
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Sat Dec 07, 2019 10:03 am

hi,

THX for help.

do you mean a RC file ... sorry i'm a Newbie
i guess so i create POKER.RC and copy/paste it

em ... what is next Step :?:

does the old Cl*pper Source real work ...
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby Silvio.Falconi » Sat Dec 07, 2019 11:07 am

the resource not run well
you must create the dialog with @x,y source
type
Code: Select all  Expand view

#include "fivewin.ch"
#include "constant.ch"

FUNCTION poker()
LOCAL i
            Local nBottom   := 30
            Local nRight    := 65
            Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
            Local nHeight := nBottom * DLG_CHARPIX_H
            Local oCursor :=TCursor():New(,'HAND')



cards := array(5)
cardname := array(52)
cardname[1]=cBmpPath+"card1.bmp"
cardname[2]=cBmpPath+"card2.bmp"
cardname[3]=cBmpPath+"card3.bmp"
cardname[4]=cBmpPath+"card4.bmp"
cardname[5]=cBmpPath+"card5.bmp"
cardname[6]=cBmpPath+"card6.bmp"
cardname[7]=cBmpPath+"card7.bmp"
cardname[8]=cBmpPath+"card8.bmp"
cardname[9]=cBmpPath+"card9.bmp"


for i = 10 to 52
   cardname[i] = cBmpPath+"card" + alltrim(str(i),2,0) + ".bmp"
next

cardmap  = cBmpPath+"back.bmp"
 nRowCard:=10



DEFINE DIALOG oDlg         ;
   TITLE "Fivewin Poker"    ;
   SIZE nWidth, nHeight


 @ nRowCard,1 bitmap bi1 file cardmap SIZE 40,50 OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(11),DurchG2(11)))

 ACTIVATE DIALOG oDlg CENTERED



I made a test many year ago Look this

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Sun Dec 08, 2019 9:50 pm

hi,

i have try your Code-Snip and have Problem with "missing" LIB ?
Error: Unresolved external '_HB_FUN_TCURSOR' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_SETRESOURCES' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_TDIALOG' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_TBITMAP' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_DURCHG1' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_DURCHG2' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_FREERESOURCES' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_FW_GT' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ

i use
Code: Select all  Expand view
c:\fwh\samples\build.bat FWPOKER
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby cnavarro » Sun Dec 08, 2019 10:15 pm

Jimmy wrote:hi,

i have try your Code-Snip and have Problem with "missing" LIB ?

i use
Code: Select all  Expand view
c:\fwh\samples\build.bat FWPOKER


Try with buildh.bat
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Mon Dec 09, 2019 5:33 am

cnavarro wrote:Try with buildh.bat

YES ...

Question : when using BUILD.BAT and when BUILDh.BAT :?:

now i got EXE ... but it is only empty Form :(
in Source i have something like this

Code: Select all  Expand view

   set resources to "cards.dll"
   ...
   cardname[1]="card1.bmp"
   ...
   bi1:loadbmp(cardmap)
 

so where does "card1.bmp" come from :?:
i can't "see" how Resource work.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby cnavarro » Mon Dec 09, 2019 9:24 am

Build.bat is for console applications (Fivewin is not used), they are only Harbour applications.
Buildh.bat is for applications using Fivewin and Borland as a compiler.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: c:\fwh\samples\poker\poker.prg

Postby Silvio.Falconi » Mon Dec 09, 2019 12:03 pm

Jimmy wrote:hi,

i have try your Code-Snip and have Problem with "missing" LIB ?
Error: Unresolved external '_HB_FUN_TCURSOR' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_SETRESOURCES' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_TDIALOG' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_TBITMAP' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_DURCHG1' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_DURCHG2' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_FREERESOURCES' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ
Error: Unresolved external '_HB_FUN_FW_GT' referenced from C:\FWH\SAMPLES\2\FWPOKER.OBJ

i use
Code: Select all  Expand view
c:\fwh\samples\build.bat FWPOKER




My code was only a sample to see to you how you must make instead of use resources

Image

For use resources
rem these lines on poker.prg ( to rem you must insert // before on each line

Code: Select all  Expand view
set resources to "po.dll"
set 3dlook on


please create this file RC
Poker.rc
Code: Select all  Expand view
Blatt DIALOG 18, 18, 327, 210
STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU
CAPTION "P O K  E R"
FONT 10, "Arial"
{
    CONTROL         "", 121, "TBitmap", 0x50000000, 12, 64, 44, 58, 0x00000000
    CONTROL         "", 122, "TBitmap", 0x50000000, 75, 64, 44, 58, 0x00000000
    CONTROL         "", 123, "TBitmap", 0x50000000, 143, 64, 44, 58, 0x00000000
    CONTROL         "", 124, "TBitmap", 0x50000000, 209, 63, 44, 58, 0x00000000
    CONTROL         "", 125, "TBitmap", 0x50000000, 274, 63, 44, 58, 0x00000000
    PUSHBUTTON      "&Geben", 201, 25, 146, 60, 14, 0, WS_EX_LEFT
    PUSHBUTTON      "&Ziehen", 202, 106, 146, 60, 14, 0, WS_EX_LEFT
    PUSHBUTTON      "&Beenden", 203, 195, 146, 60, 14, 0, WS_EX_LEFT
    EDITTEXT        301, 101, 175, 34, 12, 0, WS_EX_LEFT
    LTEXT           "Einsatz:", 65535, 66, 177, 34, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Text", 65535, 378, 4294967248, 16, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Buben-Paar oder besser", 65535, 10, 10, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Zwei Paare", 65535, 10, 20, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Drei Gleiche", 65535, 10, 30, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Flash  (Farbe)", 65535, 10, 40, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  2  zu  1", 65535, 95, 10, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  3  zu  1", 65535, 95, 20, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "  5  zu  1", 65535, 95, 30, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "20  zu  1", 65535, 95, 40, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Full House", 65535, 196, 11, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Vier Gleiche", 65535, 196, 21, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Farbstraße", 65535, 196, 31, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "Royal Flash", 65535, 196, 41, 82, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           " 50  zu  1", 65535, 281, 11, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "100  zu  1", 65535, 281, 21, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "200  zu  1", 65535, 281, 31, 32, 8, SS_LEFT, WS_EX_LEFT
    LTEXT           "500  zu  1", 65535, 281, 41, 32, 8, SS_LEFT, WS_EX_LEFT
}



and then recompile the poker.prg you found on samples/poker with the resource file poker.rc I send you on this topic



For not use resources

Image

you must converte all to @x,y


1. please use this file I try to converte

Code: Select all  Expand view

* POKER-SPIEL mit FIVEWIN+CLIPPER
*
*
* (c) 1995 Manfred Guettler , Ringweg 11 , D-29323 Wietze
* CIS - 100115,2725
* Tel.: 05149/4833
*
* Es sind sicherlich noch einige kleine Fehler vorhanden und
* es k”nnen noch einige Sachen ge„ndert werden, aber ...
* man kann spielen.
*
* A simple poker-play writen in Clipper with Fivewin
* if someone change or modify the code, please send
* me a copy. Thanks.
*
*

 
* POKER-SPIEL mit FIVEWIN+CLIPPER
*
*
* (c) 1995 Manfred Guettler , Ringweg 11 , D-29323 Wietze
* CIS - 100115,2725
* Tel.: 05149/4833
*
* Es sind sicherlich noch einige kleine Fehler vorhanden und
* es k”nnen noch einige Sachen ge„ndert werden, aber ...
* man kann spielen.
*
* A simple poker-play writen in Clipper with Fivewin
* if someone change or modify the code, please send
* me a copy. Thanks.
*
*

#include "fivewin.ch"
#include "constant.ch"     //add by silvio

#DEFINE WINNING_AMT 100000

STATIC oDlg,oget,ob1,ob2,ob3,bi1,bi2,bi3,bi4,bi5
STATIC handstring,payoff,pdeck,flipped
STATIC pokermode,sbet,lasttitle
STATIC cardmap,cflag,score
STATIC cards,cardname
static cFolderBmp    //add by silvio

FUNCTION poker()
LOCAL i

//set resources to "po.dll"
//set 3dlook on

            Local nBottom   := 30        //add by silvio
            Local nRight    := 85        //add by silvio
            Local nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )  //add by silvio
            Local nHeight := nBottom * DLG_CHARPIX_H   //add by silvio
            Local oCursor :=TCursor():New(,'HAND')     //add by silvio
            Local nRowCard:=64                      //add by silvio






HandString := Array(10)
Payoff := Array(10)
PDeck := array(52)
flipped := {0,0,0,0,0}
HandString[1]  =  "Keine Wertung"
Payoff[1]      = -1
HandString[2]  =  "Buben-Paar oder besser 2 zu 1"
Payoff[2]      =  2
HandString[3]  =  "Zwei Paare             3 zu 1"
Payoff[3]      =  3
HandString[4]  =  "Drei Gleiche           5 zu 1"
Payoff[4]      =  5
HandString[5]  =  "Straße                10 zu 1"
Payoff[5]      =  10
HandString[6]  =  "Flush (Farbe)         20 zu 1"
Payoff[6]      =  20
HandString[7]  =  "Full House           50 zu 1"
Payoff[7]      =  50
HandString[8]  =  "Vier Gleiche        100 zu 1"
Payoff[8]      =  100
HandString[9]  =  "Farbstraße          200 zu 1"
Payoff[9]      =  200
HandString[10] =  "Royal Flush         500 zu 1"
Payoff[10]     =  500
CFlag          =  0
score          =  1000
sBet           = '10 '
lastTitle      =  0
PokerMode      =  1


cFolderBmp:= ".\bitmaps\"            //add by silvio

cards := array(5)
cardname := array(52)
cardname[1]=cFolderBmp+"
card1.bmp"
cardname[2]=cFolderBmp+"
card2.bmp"
cardname[3]=cFolderBmp+"
card3.bmp"
cardname[4]=cFolderBmp+"
card4.bmp"
cardname[5]=cFolderBmp+"
card5.bmp"
cardname[6]=cFolderBmp+"
card6.bmp"
cardname[7]=cFolderBmp+"
card7.bmp"
cardname[8]=cFolderBmp+"
card8.bmp"
cardname[9]=cFolderBmp+"
card9.bmp"


for i = 10 to 52
   cardname[i] = cFolderBmp+"
card" + alltrim(str(i),2,0) + ".bmp"
next

cardmap  = "
back.bmp"


/*

DEFINE DIALOG oDlg RESOURCE "
Blatt"

REDEFINE Button id 203 OF oDlg action oDlg:end()
REDEFINE Button ob2 id 202 OF oDlg action ( IF(okbet(),DurchG2(1),) )
REDEFINE button ob1 id 201 OF oDlg action (IF(okbet(),playhand(),) )
REDEFINE get oget var sBet id 301 OF oDlg valid okbet()

REDEFINE bitmap bi1 file cardmap id 121 OF oDlg ;
    on click (IF(pokermode=1,DurchG1(11),DurchG2(11)))
REDEFINE bitmap bi2 file cardmap id 122 OF oDlg ;
   on click (IF(pokermode=1,DurchG1(12),DurchG2(12)))
REDEFINE bitmap bi3 file cardmap id 123 OF oDlg ;
    on click (IF(pokermode=1,DurchG1(13),DurchG2(13)))
REDEFINE bitmap bi4 file cardmap id 124 OF oDlg ;
    on click (IF(pokermode=1,DurchG1(14),DurchG2(14)))
REDEFINE bitmap bi5 file cardmap id 125 OF oDlg ;
    on click (IF(pokermode=1,DurchG1(15),DurchG2(15)))

ACTIVATE DIALOG oDlg CENTERED

set resources to

RETURN nil
*/

//DIALOG SOURCE //add by silvio

DEFINE DIALOG oDlg         ;
   TITLE "
Fivewin Poker"    ;
   SIZE nWidth, nHeight


@ nRowCard,12 bitmap bi1 file cardmap SIZE 40,50 PIXEL OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(11),DurchG2(11)))
@ nRowCard,75 bitmap bi1 file cardmap SIZE 40,50 PIXEL OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(12),DurchG2(12)))
@ nRowCard,143 bitmap bi1 file cardmap SIZE 40,50 PIXEL OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(13),DurchG2(13)))
@ nRowCard,209 bitmap bi1 file cardmap SIZE 40,50 PIXEL OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(14),DurchG2(14)))
@ nRowCard,274 bitmap bi1 file cardmap SIZE 40,50 PIXEL OF oDlg NOBORDER;
   on click (IF(pokermode=1,DurchG1(15),DurchG2(15)))

  @  177,66 SAY     "
Einsatz:" size 40,10 PIXEL OF oDlg
//REDEFINE get oget var sBet id 301 OF oDlg valid okbet()
@ 177, 101 get oget var sBet  Size 50,10 PIXEL  OF oDlg valid okbet()

//REDEFINE Button id 203 OF oDlg action oDlg:end()
@ nRowCard+150,100 BUTTON "
EXIT"  size 40,10 PIXEL OF oDlg action oDlg:end()

//REDEFINE Button ob2 id 202 OF oDlg action ( IF(okbet(),DurchG2(1),) )
@ nRowCard+150,100 BUTTON ob2 PROMPT "
DEAL" size 40,10 PIXEL OF oDlg action ( IF(okbet(),DurchG2(1),) )

//REDEFINE button ob1 id 201 OF oDlg action (IF(okbet(),playhand(),) )
@ nRowCard+150,200 BUTTON ob1 PROMPT "
DRAW" size 40,10 PIXEL OF oDlg action (IF(okbet(),playhand(),) )



     @ 10,10 SAY  HandString[2] PROMPT "
Buben-Paar oder besser" size 80,10 PIXEL OF oDlg
     @ 10,95 SAY  "
 2  zu  1"  size 80,10 PIXEL OF oDlg




ACTIVATE DIALOG oDlg CENTERED

return nil

FUNCTION playhand()
**********************************************
LOCAL i, sel, c, h

UpdateTitles(0)

FOR i = 1 to 5
   DrawCardBack(i)
NEXT

ResetCards()


FOR i = 1 to 5
   cards[i] = RandomCard()
   DrawCard(i)
NEXT

h = HandCompute()
UpdateTitles( h )

ob1:disable()
ob2:enable()

pokerMode = 2

Return nil


FUNCTION ResetCards()
afill(@PDeck, 0)
flipped := {0,0,0,0,0}

IF CFlag = -1
   PDeck[1]  = 49
   PDeck[2]  = 52
   PDeck[3]  = 15
   PDeck[4]  = 33
   PDeck[5]  = 50
   PDeck[6]  = 40
   PDeck[7]  = 51
   PDeck[8]  = 19
   PDeck[9]  = 37
   PDeck[10] =  8
   CFlag = 1
ENDIF

Return nil


Function RandomCard
**********************************************
LOCAL i, stop

   IF CFlag > 0
      CFlag = CFlag + 1
      RETURN PDeck[CFlag - 1]
   ENDIF

   stop = .t.

   do while stop
    i = nRandom( 53 )  // int(ft_rand1(53))
    IF i=0
        i:=1
    ENDIF

    IF i>52
      i := 52
    ENDIF
          *sginfo(i)
      IF PDeck[i] = 0
         PDeck[i] = 1
         stop = .f.
      ENDIF
   ENDDO

RETURN i


FUNCTION DrawCard(i)
**********************************************
cardmap = cardname[cards[i]]
IF i = 1
   bi1:loadbmp(cardmap)
ENDIF
IF i = 2
   bi2:loadbmp(cardmap)
ENDIF
IF i = 3
   bi3:loadbmp(cardmap)
ENDIF
IF i = 4
   bi4:loadbmp(cardmap)
ENDIF
IF i = 5
   bi5:loadbmp(cardmap)
ENDIF
Return nil

FUNCTION UpdateTitles(n)
IF n = LastTitle
   RETURN nil
ENDIF

Lasttitle = n
Return nil


Function HandCompute
**********************************************
LOCAL i, straight, flush, retv, ai,val,highpair,suit
LOCAL suits, counts, groups, high1, low1, high2, low2

counts := {0,0,0,0,0,0,0,0,0,0,0,0,0}
suits  := {0,0,0,0}
groups := {0,0,0,0}

   low1     = 15
   high1    = 0
   low2     = 15
   high2    = 0
   highpair = 0
   straight = 0
   ai       = 0
   i        = 0

   FOR i = 1 to 5
      val = int(mod((cards[i] - 1), 13)) + 1
      suit = int((cards[i] - 1)/13) + 1
      counts[val] = counts[val] + 1
      suits[suit] = suits[suit] + 1
      low1        = Min(low1, val)
      high1       = Max(high1, val)
      IF val      = 1
         ai       = 14
      else
         ai       = val
      endif
      low2        = Min(low2, ai)
      high2       = Max(high2, ai)
   NEXT
   ai = 0

   FOR i = 1 to 13
      val = counts[i]
      IF val > 0
         groups[val] = groups[val] + 1
         IF val = 2
            if i = 1
               ai = 14
            else
               ai = i
            endif
            highpair = Max(highpair, ai)
         ENDIF
      endif
   NEXT

   if ((high1 - low1) = 4) .AND. (groups[1] = 5)
      straight = 1
   endif
   if ((high2 - low2) = 4) .AND. (groups[1] = 5)
      straight = 1
   endif

   flush = 0
   retv = 1

   FOR i = 1 to 4
      IF suits[i] = 5
         flush = 1
      ENDIF
   NEXT

   IF straight = 1 .AND. flush = 1
      IF low2 = 10
         RETV = 10
      ELSE
         RETV = 9
      ENDIF
   ENDIF

   IF groups[4] = 1
      RETV = 8
   ENDIF

   IF groups[3] = 1
      RETV = 4
   ENDIF

   IF groups[2] = 1 .AND. highpair > 10
      RETV = 2
   ENDIF

   IF groups[3] = 1 .AND. groups[2] = 1
      RETV = 7
   ENDIF

   IF flush = 1
      RETV = 6
   ENDIF

   IF straight = 1
      RETV = 5
   ENDIF

   IF groups[2] = 2
      RETV = 3
   ENDIF

RETURN RETV

FUNCTION DrawCardBack(i)
**********************************************

do case
case i=1
   bi1:loadbmp("
back.bmp")
case i=2
   bi2:loadbmp("
back.bmp")
case i=3
   bi3:loadbmp("
back.bmp")
case i=4
   bi4:loadbmp("
back.bmp")
case i=5
   bi5:loadbmp("
back.bmp")
endcase

Return NIL


FUNCTION DurchG2(sel)
**********************************************
LOCAL i, c, h

DO CASE
   CASE sel = 1
      FOR i = 1 to 5
         IF flipped[i] = 1
            cards[i] = RandomCard()
            DrawCard(i)
         ENDIF
      NEXT i
      h = HandCompute()
      UpdateTitles(h)
      afill(@PDeck, 0)

      score = score + (Payoff[h] * val(sBet))
       If Payoff[h]=-1
       msgbeep()
       msginfo("
Sie haben verloren"+CRLF+handstring[lasttitle] )
       else
       msgbeep()
       msginfo("
Sie haben gewonnen"+CRLF+handstring[h] )
       ENDIF
       @ 21,20 say "
Bank: DM " + str(score, 7, 0) OF oDlg
      If WinOrLose()
       oDlg:end()
      ENDIF
      ob2:disable()
      ob1:enable()

      IF CFlag > 1
         CFlag = 0
      ENDIF

      PokerMode = 1

   CASE sel > 10 .and. sel < 16
      c = sel - 10
      IF flipped[c] = 1
         DrawCard(c)
         flipped[c] = 0
      ELSE
         DrawCardBack(c)
         flipped[c] = 1
      ENDIF

ENDCASE

RETURN nil

**********************************************
FUNCTION DurchG1(sel)
**********************************************

   IF sel = 1       &&eben
     IF OKBet()
       PlayHand()
       PokerMode=2
     ENDIF
   ENDIF

RETURN nil

**************
Function OKBet
**************
IF val(sBet)>score
   msginfo("
Der Einsatz übersteigt Ihr Guthaben")
   RETURN .f.

ELSEIF val(sBet)<1

   msginfo("
Mindesteinsatz: 1DM ")
   RETURN .f.
ENDIF

RETURN .t.

******************
Function WinOrLose
******************
IF Score <=0
    msginfo("
Sie haben Ihr Guthaben verspielt. Mehr Glück beim naechsten Spiel.")
    RETURN(.t.)
ELSEIF Score>=WINNING_AMT
    msginfo("
Gratulation! Sie haben die Bank gesprengt!")
    RETURN(.t.)
ENDIF
RETURN .f.







I insert only some string HandString[2] you can continue to insert the others
you must use the folder bitmaps where you can insert all cards bitmaps ( also the back.bmp)
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Mon Dec 09, 2019 8:22 pm

hi
cnavarro wrote:Build.bat is for console applications (Fivewin is not used), they are only Harbour applications.
Buildh.bat is for applications using Fivewin and Borland as a compiler.

ah ... OK now i begin to understand, THX
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby cnavarro » Mon Dec 09, 2019 8:24 pm

Buildh32.bat is for Visual Studio Community Compiler
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: c:\fwh\samples\poker\poker.prg

Postby Jimmy » Mon Dec 09, 2019 8:31 pm

Hi
Silvio.Falconi wrote:My code was only a sample to see to you how you must make instead of use resources

thanks for your patience with a Newbie.

Silvio.Falconi wrote:I insert only some string HandString[2] you can continue to insert the others
you must use the folder bitmaps where you can insert all cards bitmaps ( also the back.bmp)

OK i understand.

so i'm back to my Question : how to load Resource cards.dll for a Game like this :?:
as i say it is not the Game it is how to load those Resource.

---

i have copy/paste that Code and open CMD Box and run
Code: Select all  Expand view
c:\fwh\samples\buildh.bat fwpoker


Compiling...
Harbour 3.0.0 (Rev. 16951)
Copyright (c) 1999-2011, http://harbour-project.org/
Compiling 'fwpoker.prg' and generating preprocessed output to 'fwpoker.ppo'...
fwpoker.prg(37) Error F0029 Can't open #include file 'fivewin.ch'
* Compile errors *

as i say i have Problem with FiveWin Environment :!:

after SET FW Environment it does compile an show Dialog.
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1589
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: c:\fwh\samples\poker\poker.prg

Postby Silvio.Falconi » Tue Dec 10, 2019 9:18 am

where I can write to you ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6796
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 17 guests