Crossword (basic frame)

zhaozj2021-02-16  92

Wife likes to play the vertical and horizontal puzzle, such as "small strong ripping" in the southern weekend, always arrived. Recently, I have nothing to do, I don't want to make a computer to play, with a wife smile, ^ - ^. Should there be a TPUZZLITEM class? This represents a single entry of the puzzle, including coordinates, direction (horizontal or longitudinal), mystery, mystery, etc. This TPUZZLEITEM should also have some ways (there is no way, there is no need to exist), and more important is the character of the cell according to a given logical coordinate (if the given coordinate does not belong to this entry, Return empty), in order to facilitate import and export, both methods of ExportToxmlNode and ImportFromxmlNode to facilitate importing according to the XML node. Multiple entries should be managed by the TPUZZLE Class, TPUZZLE has a private TList object to maintain item list instead of letting TPUZZLE inherits from Tcollection, because I really don't want to understand the internal structure of this tcollection, use delegate rather than inheritance, It is also a consistent approach. Similarly, TPUZZLE should also have both methods of ExportToxmlNode and ImportFromxmlNode. Each TPUZZLE represents a puzzle, in order to distinguish between different puzzles, it has a GUID property. TPUZZLE and TPUZZLEITEM are completely unrelated to the GUI, which is just the logic of puzzles, as for how to implement on the interface, how to interact with users, handed over to TPUZZLEGUI. TPUZZLEGUI entrusts a private field FPUZLE to handle logic issues, accept your user's input, responsible for drawing puzzles on the screen. TPUZZZLEGUI inherits from TCUSTOMControl and has WS_VScrollbar and WS_HSCROLLBAR properties, which can display a large grid to the user (although it can actually be used), since the two-dimensional array is not established, it is only maintained by TPUZZLE. The list of items, the memory that is occupied does not increase due to how much the grid displayed on the screen. The interface is designed to be simple. Anyway, everything is drawn. Due to the small place to draw, TPUZZLEGUI also uses a buffer, first draws all the content you want to draw in the buffer, once again Screen, a bit like DirectDraw practice, but this little play doesn't have to drive DX. The interface design is slightly thin, and the feeling of bringing the user is better. Unfortunately, it is not a beauty, there is no way to draw everything so perfect :-( There is a problem with how to save multiple puzzles, this storage TPUZZLCONTAINER is completed, this is an abstract class that can be easily changed in order, and it is said that I use XML to store it today. I will use an access library. Abstract factory model should be used. Although I can't see any benefits, huh, huh.

转载请注明原文地址:https://www.9cbs.com/read-12627.html

New Post(0)