RJL Comments on Message 24/1421 From Anthony J Gabrielson Nov 20, 06 11:31:29 AM RJLRef: $PH/06f522/SetGame06f/ProjectGUI_ag_rjlFdbk061120 ------------------ Notes on ProjectGUI.cpp - RJL061120 (my cc: ~/06f522/SetGame06f/ProjectGUI_ag061120.cpp Anthony did a nice job of organizing this code and documenting it. I have some quibbles about more meaningful names. Just as bde can pick up one diagram (HG-row container) and map it to a canvas window and draw it there, this code should be able to pick up any incoming commands and use them to render a new 12-card layout. I don't yet see any inhereitance mechanisms. Is someone else doing that? I am looking forward to how others integrate LCP and genv13 logging code with this GUI. See my last note below re: enabling the GUI loop to respond to the Server event stream; the Client-to-Server path is easier since GUI mouse event and/or kbd callbacks can emit upward-flowing event instances. Bob Lechner More specific comments follow: ------------------------------ Lines 20-25: Your #define'd constants have no explanation of their relation to card size (WIDTH by HEIGHT). Nor does setPosition[x] mean upper left corner unless you say so. I had to read checkPiece to find these facts. Should WIDTH and HEIGHT be scaled proportional to board size? Will this permit cards to scale as window size? (E.g. by myReshape). Why do you call the card a 'piece'? I like line 36: setPosition setPos[12]; rather than an algorithmic conversion from radix 12 to radix 4 by radix 3. It gives an opportunity to have a user rearrange the layout. This is what real game players do, especially to repack the cards when there are no more cards to supply from an exhausted deck. Of course, the layouts become out of sync, and a relocation map must be kept between Server and local card positions (a Client responsibility). Howver, I would rename setPos[] to suggest a state not an action. Line 40: /* drawLineLoop(): draw the rectangle around the game piece. so where is the call to drawCard(color, shape, pattern, count)? Line 91: void left_mouse_cmd(int btn, int state, int xx, int yy) How about void left_mouse_cmd(int btn, int btnstate, int mxx, int myy) (these are less likely to be confused with varnames in other scopes). -------------------------- Here I supose you or others will continue elaborating: Line 150: /* drawBoard(): Draw all the game pieces. (it calls drawLineLoop() to 'draw the rectangle around the game piece'.] So where is the call to drawCard(color, shape, pattern, count)? I presume a stub for calling 'drawCard()' is to be added? Will it be subclassed for each of 9 card pairs? You handle color as a property in setPieceColor(x); Do you expect to parametrize shading pattern the same way? Border color with none/light/dark fill is an alternate to a dashed shading pattern, that some imitators of SetGame use (see my references). That would be OK for now. Line 213: What is purpose of x and y? (glut-required but not used here?): void keyboard( unsigned char key_pressed, int x, int y ) Line 228: What is visual effect of these defaults? /* defaultPieces(): set the default for all game pieces. Line 289: How does the GUI's main loop permit external events to affect its behavior? (i.e. event messages/commands, not mouse or keyboard-detectable). X11 has AddWorkProc, called after dispatching locally queued mouse and kbd events, AddFile input, and AddTimer-something to escape from the GUI event loop. eklein showed an untested example of each one for the Hominid project although it did not try bde replay that way. (Hominid used the keypress callback as a user 'Pull' mode; SetGame needs an event instance 'Push' mode of Server to Client intervention.) ================ Message 24/1421 From Anthony J Gabrielson Nov 20, 06 11:31:29 AM -0500 To: Bob Lechner cc: all Hello, I have a proof of concept GUI almost done. It draws 12 rectangles on the screen that can be selected 3 at a time and cleared. The only real feature the GUI is missing is a box (within the GUI) that is able to display the score. Once I have that completed I will be ready to start integrating other peoples code; once they have completed it (i.e.): Generate 81 different pieces. Draw the actual game piece Verify the selection of 3 pieces After that stage I will be ready for integration of network code. I have placed the code in my project directory, available to everyone at this location: /usr/proj3/case/06f522/agabriel/FinalProject/GUI If you so desire, take a peak at the code and let me know what you think thus far. Thanks, Anthony -------------------------------------