hb_Tetris

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2063
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

hb_Tetris

Post by AUGE_OHR »

hi,

this is a old Cl*pper Game which i had ported to Xbase++ GUI.
now i have test that Source with harbour and got it run under Cl*pper Style :D
hb_Tetris.jpg
hb_Tetris.jpg (457.67 KiB) Viewed 2029 times
as i say i have ported it to Xbase++ using XbpBrowse() which is like TBrowse but GUI.
"Playground" is a Array. depend on Value of a Cell you can see Color.

while XbpBrowse() Version of GTWVG some VAR missing i have used a lot of #IFDF __XPP__
also i have Problem with "Preview" ... it is the same Syntax like "Playground" ...

but my biggest Problem : it does not move/show ... until i use vertical Scrollbar :!:
hb_Xb_Tetris.jpg
hb_Xb_Tetris.jpg (80.05 KiB) Viewed 2029 times
so what is going on :?:
where does that vertical Scrollbar come from :?:

ok i have disable it while it does not compile

Code: Select all

#IFDEF __XPP__
   oBrowse:hScroll   := .F.
   oBrowse:vScroll   := .F.
   oBrowse:sizeCols  := .F.
   oBrowse:cursorMode:= XBPBRW_CURSOR_NONE
   oBrowse:useVisualStyle := .F.
#ENDIF
... but "Playground" Array is fix Size so no Reason for any Scrollbar ... :(

here is the Soure Code
hbTETRIS.ZIP
(9.78 KiB) Downloaded 143 times
have fun
---
p.s.
i guess it can also use a GRID while "Playground" is a Array.
"Calculation" of GRID are in FUNCTION and work for Cl*pper and Xbase++ so i guess it work with GRID too.
so this is the next Step to use HMG Syntax for this Game

---

to enable that Xbase++ Code un-Comment

Code: Select all

* #define XPPGUI .T.
than you need harbour "core-master" and copy some missing files.

Code: Select all

libQtCore4.a libQtGui4.a libhbqtcore.a libhbqtgui.a libgtqtc.a libhbxbp.a 
from c:\harbour\include\ i copy all "difference", using Total Commander, to c:\hmg.3.4.4\HARBOUR\include\

and Constribution

Code: Select all

c:\harbour\contrib\hbxbp\ 	to c:\hmg.3.4.4\HARBOUR\contrib\hbxbp\
c:\harbour\contrib\hbqt\	to c:\hmg.3.4.4\HARBOUR\contrib\hbqt\
than use this *.HBC

Code: Select all

libpaths=c:/hmg.3.4.4/HARBOUR/contrib/hbxpp
libs=hbxpp.hbc
libpaths=c:/hmg.3.4.4/HARBOUR/contrib/gtwvg
libs=gtwvg.hbc
libpaths=c:/hmg.3.4.4/HARBOUR/contrib/hbxbp
libs=hbxbp.hbc
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2063
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_Tetris

Post by AUGE_OHR »

hi

after i have learn about FMG and GRID i want to continue with hb_Tetris
aPlayground[18][20] is filled with "0" at begin but nothing is shown :o

Code: Select all

#IFDEF __HARBOUR__
#include "HMG.ch"
Declare Window PlayForm

   Load Window PlayForm
   Center Window PlayForm
*  DEFINE TIMER Timer_1 OF PlayForm INTERVAL 1000 ACTION ShowTime(hBitmap,nwide,nheight)
   // Grid_1 without any change in Property
   SetProperty( "PlayForm", "Grid_1", "ITEMS"   , aPlayground )
   SetProperty( "PlayForm", "Grid_1", "WIDTHS"  , { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 })
   SetProperty( "PlayForm", "Grid_1", "HEADERS" , { "   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   ","   "})
   SetProperty( "PlayForm", "Grid_1", "DYNAMICBACKCOLOR", { || { 100 , 149 , 237 } } )

*  oTb:Colorblock := {|xVal| IF(xVal == "0" ,{GRA_CLR_BLACK    ,GRA_CLR_BLACK    } ,;
*                                 IF(xVal == "1" ,{GRA_CLR_CYAN     ,GRA_CLR_CYAN     } ,;
*                                 IF(xVal == "2" ,{GRA_CLR_BLUE     ,GRA_CLR_BLUE     } ,;
*                                 IF(xVal == "3" ,{GraMakeRGBColor({255,138,025}), GraMakeRGBColor({255,138,025})} ,;
*                                 IF(xVal == "4" ,{GraMakeRGBColor({136,030,250}), GraMakeRGBColor({136,030,250})} ,;
*                                 IF(xVal == "5" ,{GRA_CLR_RED      ,GRA_CLR_RED      } ,;
*                                 IF(xVal == "6" ,{GRA_CLR_GREEN    ,GRA_CLR_GREEN    } ,;
*                                 IF(xVal == "7" ,{GRA_CLR_YELLOW   ,GRA_CLR_YELLOW   } ,;
*                                 IF(xVal == "8" ,{GRA_CLR_DARKGREEN,GRA_CLR_DARKGREEN} ,;
*                                 IF(xVal == "9" ,{GRA_CLR_WHITE    ,GRA_CLR_WHITE    } ,;
*                                 IF(xVal == "10",{GRA_CLR_DARKRED  ,GRA_CLR_DARKRED  } ,;
*                                 IF(xVal == "11",{GRA_CLR_PINK     ,GRA_CLR_PINK     } ,;
*                                 IF(xVal == "12",{GRA_CLR_DARKCYAN ,GRA_CLR_DARKCYAN } ,;
*                                 IF(xVal == "13",{GRA_CLR_BROWN    ,GRA_CLR_BROWN    } ,;
*                                 IF(xVal == "14",{GRA_CLR_DARKBLUE ,GRA_CLR_DARKBLUE } ,;
*                                                 {GRA_CLR_BLACK,GRA_CLR_PALEGRAY} ))))))))))))))) }

   Activate Window PlayForm
i also found DYNAMICBACKCOLOR ... can i use it like TBrowse:ColorBlock :?:
as you see i want to change Color depend on String Value of a Cell.

so how get these Lines working :?:
PlayForm.zip
(11.03 KiB) Downloaded 121 times
have fun
Jimmy
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: hb_Tetris

Post by serge_girard »

Jimmy,

I have compile error: Missing file gra.ch?

Serge
There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2063
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_Tetris

Post by AUGE_OHR »

hi,

now i have copy FMG Code to MAIN and now i "see" my Playground.
hb_Grid_Tetris01.png
hb_Grid_Tetris01.png (23.54 KiB) Viewed 1831 times
but i have the same Problem when using ON KEY while it "move" only when press a Key.

Code: Select all

DO WHILE lNoExit
  cKey := UPPER(CHR(nKey := INKEY()))
  DO CASE
     CASE nKey == K_ESC
     CASE cKey == "N"
     CASE aCargo[CG_N_GAME] != N_GAME_OVER
     DO CASE
        CASE aCargo[CG_N_GAME] == N_PAUSED .AND. nKey != 0
        CASE cKey == "P"
        CASE nKey == K_UP .OR. nKey == K_DOWN
        CASE nKey == K_LEFT .OR. nKey == K_RIGHT
        CASE nKey == K_SPACE
      ENDCASE
  ENDCASE
ENDDO          
as i remember Cl*pper it will run the hole Time in that Loop.

Code: Select all

   AppEvent( @mp1, @mp2, @oXbp,(aCargo[CG_N_CUR_WAIT]/10) )
the 4th Parameter under Xbase++ is for Timeout and that seems not to work correct under GTWVG.

so both GUI Version need a Timer to "move" when no Key is pressed.

---

Question : can i switch off Cursor in GRID :?:
even if have CELLNAVIGATION .T. i can see Rest of Cursor with other Color.

so what i ask for is to switch OFF Hi-light of Cell. is this possible or do i need Ownerdraw :?:

here latest Version BUT it will crash when reach Bottom ... and it is still alive after crash :o
you have to use Taskmanager and search for XppTetris and kill the Task :(
hb_Grid_Tetris_01.ZIP
(11.39 KiB) Downloaded 115 times
have fun
Jimmy
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: hb_Tetris

Post by serge_girard »

Jimmy

I cannot compile while GRA.CH is missing!
There's nothing you can do that can't be done...
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: hb_Tetris

Post by bpd2000 »

Refer link,
four examples by Dr. Claudio Soto:
1) RUN HORSE: graphic animation (movie)
2) VIEW IMAGE: view BMP image, load, save, rotate, transform, copy / paste clipboard, capture desktop, change the brightness, etc.
3) AIR FIRE: down planes with anti-aircraft battery
4) MOVE DOG: Move a dog
http://hmgforum.com/viewtopic.php?f=15& ... horse+game
BPD
Convert Dream into Reality through HMG
User avatar
AUGE_OHR
Posts: 2063
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_Tetris

Post by AUGE_OHR »

serge_girard wrote: Thu Nov 28, 2019 9:09 am I cannot compile while GRA.CH is missing!
oh Sorry ... again a Xbase++ Include which is not need for harbour / HMG
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2063
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hb_Tetris

Post by AUGE_OHR »

bpd2000 wrote: Thu Nov 28, 2019 10:11 am Refer link,
four examples by Dr. Claudio Soto:
1) RUN HORSE: graphic animation (movie)
2) VIEW IMAGE: view BMP image, load, save, rotate, transform, copy / paste clipboard, capture desktop, change the brightness, etc.
3) AIR FIRE: down planes with anti-aircraft battery
4) MOVE DOG: Move a dog
http://hmgforum.com/viewtopic.php?f=15& ... horse+game
thx, i will look at it.

---

i try to get this run not while i want to play the Game.
here i try to use a GRID and i want to learn how to work with it under harbour / HMG.
as i know now how to get ControlHandle i can try to write new Code if i do not found what i search.
have fun
Jimmy
Post Reply