programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: BeginPaint, EndPaint

From: elliott <echapin_at_sympatico.ca>
Date: Wed, 28 Aug 2002 08:07:23 -0400

Thanks, Mike. I'll try it and see what other errors are uncovered. Care to
elaborate on SF absolute/relative addressing and usage? I wonder if there's
any relation to USING, which I've had to use in SWOOP in a way not
mentioned in the manual. See the colon def. after the class def.

1024 VALUE XMAX
768 VALUE YMAX
0 VALUE SMAX

: SET-SMAX
    XMAX YMAX + 2/ TO SMAX
;

SET-SMAX

: BITS ( n1 -- n2 ) \ # of 1-bits in n1
    0 SWAP 32 0 DO
       2 /MOD SWAP IF
          SWAP 1+ SWAP
       THEN
    LOOP DROP ;

ICODE 8+
    8 # EBX ADD
RET END-CODE

ICODE 16+
    16 # EBX ADD
RET END-CODE

ICODE 2*8+
    8 # EBX ADD
    8 # 0 [EBP] ADD
RET END-CODE

ICODE 3*8+
    8 # EBX ADD
    8 # 0 [EBP] ADD
    8 # 4 [EBP] ADD
RET END-CODE

CLASS 4V

    32 BUFFER: DATA
     8 BUFFER: LENGTH

    : 0FILL
       0E DATA 4 0 DO
          FDUP DUP F! 8+
       LOOP FDROP DROP
       0E LENGTH F!
    ;

    : UPDATE-LENGTH
       0E DATA 4 0 DO
         DUP F@ FDUP F* F+ 8+
       LOOP DROP
       FSQRT LENGTH F!
    ;

    : RANDOMIZE
       SMAX DATA 4 0 DO
          2DUP SWAP RND S>F F! 8+
       LOOP 2DROP
       UPDATE-LENGTH
    ;

: SHOW
    DUP DATA 4 0 DO
       DUP F@ F. 8+
    LOOP DROP
    CR LENGTH F@ F. CR
;

END-CLASS

\ placeholders for vector arithmetic:
\ V1 result
\ V2 main parameter
\ V3 2nd parameter. e.g., divisor

0 VALUE V1
0 VALUE V2
0 VALUE V3

: 4V-UNITIZE \ ( v1 v2 -- ) \ assumes original vector non-0
    TO V2 TO V1
    V1 USING 4V DATA V2 USING 4V DATA V2 USING 4V LENGTH F@ ( v1data v2data
v2length )
    4 0 DO
       2DUP F@ FOVER F/ F! 2*8+
    LOOP 2DROP FDROP
    1E V1 USING 4V LENGTH F!
;

At 12:03 AM 8/28/02, you wrote:

>Elliot,
>
>ps is an object and expects a method. BeginPaint requires the
>*address* of ps so you would use
> ps ADDR as follows:
>
>[SWITCH MESSAGE-HANDLER DEFWINPROC ( -- res )
> WM_PAINT RUN:
> DISPLAY HWND ps ADDR 2DUP BeginPaint EndPaint ;
>SWITCH]
>
>Mike
>
>
>-----Original Message-----
>From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On
>Behalf
>Of elliott
>Sent: Tuesday, August 27, 2002 8:49 PM
>To: sftalk_at_forth.com
>Subject: [sftalk] Re: BeginPaint, EndPaint
>
>
>
>Right Rick. So here's what happens when I try to load:
>
>LIBRARY GLU32.DLL ok
>LIBRARY OPENGL32.DLL ok
> ok
>FVARIABLE DF ok
> ok
>: 1dfparm ( f: x -- ) ( s: -- xl xh )
> DF DUP F! 2@ SWAP ; ok
> ok
>: dfparms ( f: n*x reversed -- ) ( s: n -- n*x )
> 0 DO 1dfparm LOOP ; ok
> ok
>1 IMPORT: glClear ok
>1 IMPORT: glBegin ok
>6 IMPORT: glColor3d ok
>2 IMPORT: glVertex2i ok
>0 IMPORT: glEnd ok
>0 IMPORT: glFlush ok
>4 IMPORT: glViewport ok
> ok
>: glColor3d ( f: 3*x reversed -- s: -- 3*x )
> 3 dfparms glColor3d ; ok
> ok
>: DISPLAY
> GL_COLOR_BUFFER_BIT glClear
> GL_TRIANGLES glBegin
> 0e 0e 1e glColor3d
> 0 1 glVertex2i
> 0e 1e 0e glColor3d
> -1 -1 glVertex2i
> 1e 0e 0e glColor3d
> 1 -1 glVertex2i
> glEnd
> glFlush
>; ok
> ok
>PAINTSTRUCT BUILDS ps ok
> ok
>0 VALUE hAPP ok
>CREATE CLASSNAME ,Z" openGL triangle" ok
> ok
>: -APP ( -- flag )
> 'MAIN @ [ 'MAIN @ ] LITERAL = ; ok
> ok
> ok
>[SWITCH MESSAGE-HANDLER DEFWINPROC ( -- res ) ok
> WM_PAINT RUN:
> DISPLAY HWND ps 2DUP BeginPaint EndPaint ; BeginPaint ?
>
>
>At 05:35 PM 8/27/02, you wrote:
>
> >Elliot,
> >
> >The answer
> >
> > >>More details please. Is this SWOOP code?
> >
> >in the context of a question about why a particular phrase doesn't
> >compile or why the compiler doesn't recognize a word means: post
> >the simplest version of the code you can contrive that produces the
> >problem. No one can diagnose such a problem unless it can be
> >reproduced.
> >
> >Rick
> >
> >---------------------------------------------------------------------
>-
> >sftalk_at_forth.com The SwiftForth programming discussion email
>list
> >To unsubscribe, send subject "unsubscribe sftalk" to
>listar_at_forth.com
> >For help with listar commands, send subject "help" to
>listar_at_forth.com
> >Archives are located at http://www.forth.com/sftalk -- check them
>out!
> >Search the archives! Visit http://www.forth.com/search for
>details.
>
>
>=====
>me: http://www3.sympatico.ca/echapin
>harmless bot trap: http://88.net/cgi-bin/aha
>=====
>
>----------------------------------------------------------------------
>sftalk_at_forth.com The SwiftForth programming discussion email list
>To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
>For help with listar commands, send subject "help" to listar_at_forth.com
>Archives are located at http://www.forth.com/sftalk -- check them out!
>Search the archives! Visit http://www.forth.com/search for details.
>
>----------------------------------------------------------------------
>sftalk_at_forth.com The SwiftForth programming discussion email list
>To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
>For help with listar commands, send subject "help" to listar_at_forth.com
>Archives are located at http://www.forth.com/sftalk -- check them out!
>Search the archives! Visit http://www.forth.com/search for details.

=====
me: http://www3.sympatico.ca/echapin
harmless bot trap: http://88.net/cgi-bin/aha
=====

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe sftalk" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/sftalk -- check them out!
Search the archives! Visit http://www.forth.com/search for details.
Received on Wed Aug 28 2002 - 05:07:35 PDT

This archive was generated by hypermail 2.2.0 : Fri Nov 21 2008 - 03:04:24 PST