Hi everybody,
Now, with the new CC5 compiler, I think it is possible to make a console like program without any console.
My little demo work like a charm even on old slow computers.
The new GRAPHIC INKEY$ and GRAPHIC WINDOW CLICK commands are a dream come true.
The only thing missing is a way to catch mouse movements without having to click it.
You could then have a Web Like menu where you light buttons just by moving over them
Anybody out there able to subclass that ????
Now, with the new CC5 compiler, I think it is possible to make a console like program without any console.
My little demo work like a charm even on old slow computers.
The new GRAPHIC INKEY$ and GRAPHIC WINDOW CLICK commands are a dream come true.
The only thing missing is a way to catch mouse movements without having to click it.
You could then have a Web Like menu where you light buttons just by moving over them
Anybody out there able to subclass that ????
Code:
'A small full screen with #CONSOLE OFF demo to test the new GRAPHIC INKEY$ and GRAPHIC WINDOW CLICK Commands 'Enter text and hit Return. Esc to end or shut window with mouse 'Click anywhere on screen to position cursor and enter text #COMPILE EXE #CONSOLE OFF DEFLNG a-z FUNCTION PBMAIN () AS LONG DESKTOP GET CLIENT TO PixW,PixH: x1=0: y1=0: x2=PixW: y2=PixH fnt$="Lucida Console": pt!=18 caption$="Graphic console full screen input test Enter text and hit Return or Click Mouse to next position" x=0: y=0 ' Start print position GRAPHIC WINDOW caption$,x1,y1,x2,y2 TO hwin GRAPHIC ATTACH hwin,0,REDRAW GRAPHIC CLEAR %BLACK,%GREEN: GRAPHIC COLOR %GREEN,%BLACK ' Black background with Green text like old time GRAPHIC GET PIXEL (2,2) TO bkgr ' Find Background color if other colors used instead of black GRAPHIC FONT fnt$,pt!,1 ' Select font GRAPHIC CHR SIZE TO carw!,carh! ' Find pixel width and height of chosen graphic font MaxCol=PixW/CarW!: MaxRow=PixH/CarH! ' Maximums will depend on number of pixels on desktop GRAPHIC REDRAW KeyMouse:REM Keyboard and Mouse input GRAPHIC INKEY$ TO z$: SLEEP 1: GOSUB CursorOn: GRAPHIC GET DC TO hwin: IF hwin=0 THEN END ' Window has been closed by mouse GRAPHIC WINDOW CLICK TO clk,x!,y!: IF clk THEN x=x+1: GOSUB CursorOff: x=x!/CarW!-1: y=y!/CarH!-1: GOTO ScrnPrint IF z$="" THEN KeyMouse IF z$=CHR$(27) THEN END ScrnPrint:REM Set position and print graphic caracters on screen GRAPHIC SET POS (x*CarW!,y*CarH!) IF ASC(z$)>31 THEN GRAPHIC PRINT z$: GRAPHIC REDRAW x=x+1: IF x>MaxCol THEN BEEP: x=MaxCol IF z$=CHR$(13) THEN GOSUB CursorOff: x=0: y=y+1 IF y>MaxRow THEN BEEP: y=MaxRow GOTO KeyMouse CursorOn:REM Simple blinking cursor .5 second hog% prevent hogging resources by drawing all the time hog%=-1 is for instant draw IF (TIMER-INT(TIMER) >.5 AND hog%=0) OR hog%=-1 THEN GRAPHIC BOX (x*CarW!,y*CarH!+CarH!-4)-(x*CarW!+CarW!,y*CarH!+CarH!),0,%WHITE,%WHITE: hog%=1: GRAPHIC REDRAW END IF IF TIMER-INT(TIMER) <.5 AND hog%=1 THEN GRAPHIC BOX (x*CarW!,y*CarH!+CarH!-4)-(x*CarW!+CarW!,y*CarH!+CarH!),0,%BLACK,bkgr: hog%=0: GRAPHIC REDRAW END IF RETURN CursorOff:REM erase cursor at end of line CR or mouse click and flag instant redraw at next caracter GRAPHIC BOX (x*CarW!-CarW!,y*CarH!+CarH!-4)-(x*CarW!,y*CarH!+CarH!),0,%BLACK,bkgr: hog%=-1: GRAPHIC REDRAW RETURN END FUNCTION
Comment