home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mnth0106.zip / Timur / vol1n6.txt < prev   
Text File  |  1994-03-25  |  7KB  |  141 lines

  1. The Parlance of Squares
  2.  
  3. I love writing this column.  Not only do I look forward to 
  4. actually playing this game once it's done, but I like 
  5. contributing to something in which I strongly believe, and I 
  6. really do believe that OS/2 is the wave of the future.  
  7. Although the OS/2 community is currently small enough for one 
  8. individual to make an impact, we all know that this great 
  9. operating system will soon conquer the PC world and leave 
  10. Windows smoldering in the dirt.
  11.  
  12. Time constraints prevented me from adding as much as I 
  13. promised last month.  The only new enhancements you will find 
  14. are the implementation of dialog boxes for the "Map" menu 
  15. items.  Do not underestimate the amount of work required to 
  16. support these features, however.  A whole module was added 
  17. for the load and save routines.  The basic skeleton of the 
  18. code comes from Petzold's book, an antiquated yet still 
  19. valuable resource.
  20.  
  21. The dialog boxes themselves are created with the Dialog Box 
  22. Editor that comes with the tool kit.  The editor creates a 
  23. .dlg, a .res, and a .h file.  The .dlg file contains the 
  24. resource script commands that define the dialog boxes.  The 
  25. .res file is a compiled version of the .dlg file.  
  26.  
  27. There are a few things that should be kept in mind.  First, 
  28. do not include .res file as a module in the make file because 
  29. the resource compiler (rc) cannot combine individual 
  30. resources.  Every time rc links a resource file into the 
  31. executable, it replaces the existing resources with those in 
  32. the .res file.  If you want to include several types of 
  33. resources, then you must create a master resource script file 
  34. which contains "rcinclude" statements.  This process will 
  35. create a single .res file containing all your resources.
  36.  
  37. Second, beware of errors in the online help for the tool kit.  
  38. The only way to be certain of the information is to check the 
  39. header files.  An example is the structure definition for 
  40. FILEFINDBUF3.  Compare this with the entry in bsedos.h and 
  41. you will see what I mean.
  42.  
  43. Last of all, double-check all the parameters when using code 
  44. designed for OS/2 1.x.  Most of the 16-bit integer parameters 
  45. are now 32 bits long.  Note that there is no speed difference 
  46. between short and long integers on a true 386/486 system, 
  47. since the 32-bit wide data bus can swallow both sizes in one 
  48. gulp.
  49.  
  50. Look at the file game.rc, which is the master resource file 
  51. for this project.  It includes the dialog.dlg file that the 
  52. editor creates.  Note that both files include dialog.h - the 
  53. header file also created by the dialog editor.  I am not sure 
  54. why this is necessary, but hopefully an explanation will 
  55. present itself in due time.
  56.  
  57. The dialog box for loading and saving files follows a 
  58. convention that exists in most applications.  The two 
  59. list-boxes show a list of directories and a list of files in 
  60. the current directory, and an entry field allows you to type 
  61. in a file or path name.  Selecting a file from the list-box 
  62. places that name in the entry field automatically.  Once you 
  63. have selected a file, click on "Save" to save the current map 
  64. to that file, or click on "Load" to load that file.  The 
  65. current implementation is not 100% complete.  The load and 
  66. save option should not be combined, and there is no check for 
  67. overwriting an existing file.  These changes will be 
  68. available in the next installment.
  69.  
  70. The code for controlling both list-boxes is in the file 
  71. files.c, which will eventually become a module of generic 
  72. file I/O routines.  The fill-functions for the list-boxes are 
  73. very similar.  Any existing entries are erased and the new 
  74. entries are determined by scanning the current drive and 
  75. directory.  You may notice that the list-boxes are extra 
  76. wide.  This allows most HPFS long filenames to be displayed 
  77. in their entirety.  I only wish that my other applications 
  78. worked the same way.  As with everything else in this 
  79. project, the dimensions of the dialog box can be changed with 
  80. the editor to suit your preferences.  Those of you with high 
  81. resolution monitors and tiny system fonts will probably want 
  82. to increase the size even further.
  83.  
  84. Notice that the DosFindFirst/Next functions ignore any 
  85. extended attributes.  The map files will eventually be given 
  86. a file type (a.k.a. association) that will distinguish them 
  87. from other files without needing a special extension.  The 
  88. short-term goal of this project is to bring the game up and 
  89. running as quickly as possible, so that no one has to wait 
  90. until 1994 before he can play the game.  Note that I did not 
  91. say 1993.  Sorry folks, but this thing will not be done 
  92. before Christmas.  I think by Springtime it should be 
  93. playable.
  94.  
  95. My roommate Scott and I got into a discussion over the 
  96. importance and design of a user interface.  We ended up 
  97. agreeing on almost everything, but the differences between 
  98. the programmer (me) and the user (Scott) became very 
  99. apparant.  Coming from his point of view, Scott argued that 
  100. the UI should be designed and coded at the same time as the 
  101. rest of the program.  His concern is that leaving the 
  102. interface until later will cause inconsistencies between the 
  103. interface and the application.  I had to agree with him on 
  104. this point, but I also had to mention that trying to create 
  105. both at the same time causes most programmers to bite off 
  106. more than they can chew.
  107.  
  108. Frankly, I think that attempting to fully design an 
  109. application, interface and all, before any coding is started 
  110. is a pipe dream that only works with software devoid of 
  111. creativity.  Remember, this game cannot be designed 
  112. beforehand because it is a group project.  New ideas and 
  113. changes occur constantly, so the primary goal for the present 
  114. is not to design a complete user interface, but rather a 
  115. flexible one.  What does that mean, you ask?  It means that 
  116. the application should not be designed with only one 
  117. "look-and-feel" in mind.
  118.  
  119. In other words, there is more than one way to skin a cat, 
  120. just like there is more than one way to create a playing 
  121. field.  Pull-down menus allowed me to create a map editor 
  122. which worked without wasting too much time on the code.  Had 
  123. I taken the time to create something more sophisticated, it 
  124. would have been vastly more time-consuming to modify the more 
  125. complicated code.  And that is only the short-term problem.  
  126. In the long run, we would probably end up with a user 
  127. interface which no longer suited the task at hand.  
  128. Therefore, our approach will be to formulate an interface 
  129. which expands along with each new feature.
  130.  
  131. This, in a nutshell, is my philosophy on user interface 
  132. design.  I will be very happy to entertain any comments on 
  133. the subject.   Scott, by the way, is responsible for the new 
  134. icon, which is much better than the one I designed.  If 
  135. anyone thinks he or she can do a better job, feel free to 
  136. submit your creativity.
  137.  
  138. I am taking a short hiatus from this project, since I am 
  139. moving into a new apartment in August.  The next installment 
  140. will appear in the November issue.  This delay will also give 
  141. my readers a chance to catch up and respond.