Article Preview
Buy Now
| Print: | |
| PDF: |
Feature
Art and Letters
Drawing Hexes (and Other Things) with Text
Issue: 2.6 (July/August 2004)
Author: Lars Jensen
Author Bio: Lars Jensen is so old-school he edits programs by taping the little paper rectangles back into punch cards.
Article Description: No description available.
Article Length (in bytes): 14,098
Starting Page Number: 24
RBD Number: 2611
Resource File(s):
2611.sit Updated: Thursday, July 15, 2004 at 11:56 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
In all but the simplest projects, it's usually a good idea to develop the user interface separately from the "engine" -- that is, the program's internal operations. If this separation is complete, debugging and testing the engine can be simpler and more exhaustive. You can even create different user interfaces for different kinds of environments, from desktop applications to cell phones to Internet services.
However, you need a way to know what's happening inside your engine. I usually just dump my engine status as ASCII text to a log file or a window as needed. Text is workable, but often cumbersome -- without careful formatting, the very patterns of behavior I'd like to reveal might be hidden by the sheer bulk of it all.
This became particularly irksome for me in a hexagonal board game engine; trying to visualize the action from lists of hex coordinates was just too mind-boggling. I needed a way to "draw" the board in two dimensions using text characters instead of pixels. In this article, I'll review the design and implementation of a class and subclass that made this easy.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|










