home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / axscript / spruuids / src / readme.txt < prev    next >
Encoding:
Text File  |  1996-07-15  |  16.0 KB  |  307 lines

  1. //-------------------------------------------------------------------------
  2. // Readme.txt
  3. //-------------------------------------------------------------------------
  4. // Spruuids: A sample ActiveX Scripting host, which hosts VB Script.
  5. //-------------------------------------------------------------------------
  6. // (C) Copyright 1992-1996 by Microsoft Corporation.  All rights reserved.
  7. //
  8. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  9. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  10. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  11. // PARTICULAR PURPOSE.
  12. //-------------------------------------------------------------------------
  13.  
  14. FILES SUPPLIED
  15.     EXTERNAL HEADER FILES
  16.         ActivScp.h  -- ActiveX Scripting header file, used by Game.cpp
  17.         VBSGuids.h  -- Defines CLSID for VB Script, used by Game.cpp
  18.         CompMgr.h   -- Component Manager interfaces, used by App.cpp, MsgLoop.cpp
  19.     PROGRAM FILES
  20.         App.cpp, App.h
  21.             -- Implements Main App window via a dialog.  CApp is responsible
  22.                for creating the CMsgLoop object, and CGame object.
  23.         MsgLoop.cpp, MsgLoop.h
  24.             -- Implements .exe's message loop via IOleComponentManager.  CApp
  25.                acts as a client to the ComponentManager, implementing
  26.                IOleComponent.
  27.         OleAuto.cpp, OleAuto.h
  28.             -- Small framework for creating OLE Automation objects which have
  29.                dual interfaces.
  30.         Game.cpp, Game.h
  31.             -- Orchestrates the show, responsible for creating and coordinating
  32.                CScore, CDisplay (from Spr.cpp), and CSpriteClass's.  Handles
  33.                high-level game behaviors, such as starting and ending games,
  34.                the menus, and creating, loading, and managing VB Script through
  35.                ActiveX Scripting.
  36.         GameOA.cpp
  37.             -- OLE Automation implementation for "Game" object in object model.
  38.         Score.cpp, Score.h
  39.             -- Tracks score, level, # ships left.
  40.         Spr.cpp, Spr.h
  41.             -- Core "sprite" engine, implementing CDisplay, CSpriteClass, and
  42.                CSprite.
  43.             -- CDisplay implements the display surface on which the
  44.                sprites are drawn, and handles drawing the sprites, updating
  45.                their positions on timer ticks, and tracking collisions between
  46.                the sprites.
  47.             -- CSpriteClass implements a set of functionality shared between
  48.                common kinds of sprites, such as the starting image used, how
  49.                sprites of this class interact with the border, etc.
  50.             -- CSprite implements a "sprite" which basically a repository for
  51.                position, velocity, image, etc.
  52.         SprOA.cpp
  53.             -- Implements the "SpriteClass" and "Sprite" OLE Automation
  54.                interfaces for the CSpriteClass and CSprite classes,
  55.                respectively.
  56.         Guids.cpp, Guids.h
  57.             -- Simple file to get all necessary GUIDs to the linker.
  58.         Helpers.h
  59.             -- Implements some obligatory ANSI/Unicode helpers.
  60.         Main.h
  61.             -- Main include file included by everyone.
  62.         SpruuidP.Pix, SpruuidP.hh, SpruuidP.h
  63.             -- Helper files which tells the sprite engine about the graphics
  64.                found within the main sprite bitmap, Spruuids.bmp
  65.         DispIDs.h
  66.             -- Defines the DISPIDs used for events.
  67.         Spruuids.odl
  68.             -- Declares the object model for the Spruuids.exe application.
  69.     BITMAPS
  70.         Spruuids.bmp  -- Contains all of the interesting images.
  71.         Ship.bmp      -- Contains the image used to display the # ships left.
  72.         Plus.bmp      -- Graphics used to display a "+" when not enough room
  73.                          to display # ships left.
  74.     SAMPLE SPRITE.EXE INPUT FILES
  75.         Game1.txt     -- Simple samples illustrating how to use some
  76.         Game2.txt        primitives from the Game object model.
  77.         Game3.txt
  78.         GameFull.txt  -- Complete fun-to-play game.
  79.  
  80.     CLASSES IN SPRUUIDS' IMPLEMENTATION
  81.         CApp implements
  82.             IUnknown
  83.             IDispatch Using COleAuto
  84.             SpruuidsApp
  85.             IOleComponent
  86.         CGame implements
  87.             IUnknown
  88.             IDispatch Using COleAuto
  89.             Game
  90.             IActiveScriptSite
  91.             IProvideClassInfo
  92.             IProvideClassInfo2
  93.             IConnectionPointContainer
  94.             IConnectionPoint via an embedded class
  95.         CMsgLoop implements
  96.             IOleComponentManager
  97.         CScore
  98.         CDisplay
  99.         CSpriteClass implements
  100.             IUnknown
  101.             IDispatch Using COleAuto
  102.             SpriteClass
  103.             IProvideClassInfo
  104.             IProvideClassInfo2
  105.             IConnectionPointContainer
  106.             IConnectionPoint via an embedded class
  107.         CSprite
  108.             IUnknown
  109.             IDispatch Using COleAuto
  110.             Sprite
  111.  
  112. RUNNING SPRUUIDS.EXE
  113.     Command Line:
  114.         Spruuids <VB Script File>
  115.     where
  116.         <VB Script File> is the relative or full path to a VB Script
  117.     file containing the source code which Spruuids is to load and run.  See
  118.     Game*.txt for samples of VB Script programs written against Spruuids.exe.
  119.  
  120. COMPILING SPRITE.EXE
  121.     Use MkTypLib.exe to compile "Spruuids.odl" into "Spruuids.h" and
  122.         "Spruuids.tlb".  NOTE THAT Spruuids.tlb MUST BE GENERATED BEFORE THE .RC
  123.         FILE CAN BE COMPILED WITH RC.EXE!
  124.     Compile each of the *.cpp files.
  125.     Use RC.exe to compile the "Spruuids.rc" into "Spruuids.res", noting that
  126.         "Spruuids.tlb" must be included as a resource of type "TYPELIB",
  127.         so it must have been created first.
  128.     Link everything togther, and use RC.exe to add the .res to the .exe.
  129.  
  130. SPRUUIDS' OBJECT MODEL
  131.     Application As SpruuidsApp
  132.         R/O Properties
  133.             Application - Returns the Application object (returns itself).
  134.             Parent - Returns the Application object (returns itself).
  135.             Game - Returns the "Game" object, described below.
  136.         Methods
  137.             Quit() - Causes Spruuids to terminate.
  138.  
  139.     Game As Game
  140.         R/O Properties
  141.             Application - Returns the Application object.
  142.             Parent - Returns the Application object.
  143.             ShipClass As SpriteClass - Returns the SpriteClass for the ship.
  144.             BubbleClass As SpriteClass - Returns the SpriteClass for bubbles.
  145.             AmmoClass As SpriteClass - Returns the SpriteClass for ammo.
  146.             ExtraClass As SpriteClass - Returns the SpriteClass for extra,
  147.                 special effects, or general use.
  148.        R/W Properties
  149.             Caption As String - Sets the caption of the main Spruuids window.
  150.             StatusText As String - Sets the status text of Spruuids.
  151.             Width As Integer - Width, in pixels, of the display area.
  152.             Height As Integer - Height, in pixels, of the display area.
  153.             Paused As Boolean - Sets or clears the paused game.
  154.             Score As Integer - Current score.  Setting this will not compute
  155.                 extra ships gained.  Use AddScore() to ensure this calcualtion.
  156.             Level As Integer - Current level.
  157.             ShipCount As Integer - Current number of ships left.
  158.             ScoreFirst1Up As Integer - Score at which the first extra ship is
  159.                 awarded.
  160.             ScoreSecond1Up As Integer - Score at which the second extra ship
  161.                 is awarded.
  162.             DScoreNext1Up As Integer - Delta score for each extra ship award
  163.                 after the second.
  164.             ShipsStart As Integer - Number of ships to start game with.
  165.             Tag As Variant - General storage for the user.
  166.         Methods
  167.             StartGame() - Starts a new game, propting the user first, if a
  168.                 game is already in progress.
  169.             EndGame() - Ends the current game.
  170.             RemoveAllSprites() - Destroys all sprites.
  171.             NextLevel() - Increments the Level number, updating the level
  172.                 display
  173.             Refresh() - Forces the display to be refreshed.
  174.             AddScore(amt As Integer) - Adds the given amount to the score,
  175.                 rounding up to zero, if necessary.  Also computes to see
  176.                 if an extra ship should be awarded.
  177.             StdBorderBounce(s As Sprite, brd As Integer) - Ensures that
  178.                 the sprite's velocities will cause the sprite to bounce.
  179.             StdBorderWrap(s As Sprite, brd As Integer) - Move the sprite
  180.                 to the other edge of the screen.
  181.             StdInitRand(s As Sprite, u As Variant) - Moves the sprite to some
  182.                 random location on the display at least u pixels away from
  183.                 the center.  Ensures that the sprite does not start out
  184.                 overlapping a sprite it would cause a Collide event with.
  185.             StdInitEdge(s As Sprite, u As Variant) - Moves the sprite to some
  186.                 random location around the edge of the display.  u is ignored. 
  187.         Events
  188.             NewGame() - Fired when a new game is started.
  189.             NewLevel() - Fired when NextLevel is called.
  190.             NewShip() - Fired when a new ship is awarded.
  191.             Tick() - Fired every timer tick.
  192.             Collide(s1 As Sprite, s2 As Sprite, coll As Integer) - Fired when
  193.                 two sprites move so they overlap.  S1 is always the sprite
  194.                 with the lower id (ShipClass < BubbleClass < AmmoClass <
  195.                 ExtraClass).  Coll is the bit-wise AND of s1.Parent.Collide
  196.                 with s2.Parent.Collide.  So with judicious setting of the
  197.                 Collide propertis, coll is enough to tell what types of 
  198.                 sprites collided, and what s1 and s2 are.  Bit 1 is special
  199.                 and is used to indicate that a sprite should generate this
  200.                 event when it hits sprites of its own class.
  201.             KeyDown(vk As Integer) - Fired when key is depressed.  vk contains
  202.                 the virtual key code, as defined in Windows.h.
  203.             KeyPress(ascii As Integer) - Fired when key is depressed.  ascii
  204.                 contains the ascii value of the key pressed.
  205.             KeyUp(vk As Integer) - Fired when key is released.  vk contains
  206.                 the virtual key code, as defined in Windows.h.
  207.             MouseMove(x As Integer, y As Integer, keys As Integer, button As
  208.                 Integer) - Fired when mouse moves over the play surface of
  209.                 Spruuids.  x and y are the pixel location of the mouse relative
  210.                 to the upper left corner of the play surface.  keys indicates
  211.                 whether the SHIFT key is depressed (bit 1) or the CONTROL key
  212.                 is depressed (bit 2).  button indicates which buttons are
  213.                 currently depressed (any combination of: 1=left, 2=right,
  214.                 4=middle).
  215.             MouseDown(x As Integer, y As Integer, keys As Integer, button As
  216.                 Integer) - Fired when the user depresses a mouse button. 
  217.                 button indicates which button was depressed (one of: 1=left,
  218.                 2=right, 4=middle).
  219.             MouseUp(x As Integer, y As Integer, keys As Integer, button As
  220.                 Integer) - Fired when the user releases a mouse button. 
  221.                 button indicates which button was released (one of: 1=left,
  222.                 2=right, 4=middle).
  223.  
  224.     SpriteClass Objects
  225.         R/O Properties
  226.             Application - Returns the Application object.
  227.             Parent - Returns the Game object.
  228.             SpriteCount As Integer - The number of existing sprites of
  229.                 this kind.
  230.         R/W Properties
  231.             Image As Integer - A number indicating the default graphic
  232.                 to be used for sprites of this class.
  233.             Brd As Integer - A bitfield indicating the display borders with
  234.                 which sprites of this class are interested in being notified
  235.                 (via the Border event) when then touch them.  See Spr.h for
  236.                 the definition of this bitfield.
  237.             Collide As Integer - a bitfield used to determine whether to fire
  238.                 the Game_Collide event, as described above.
  239.             Friction As Single - Indicates the amount of friction sprites of
  240.                 this class should default to.  Values 0<n<1 slow the ship.  The
  241.                 value 1 is the same as no friction (default).  Values >1 will
  242.                 cause the ship to automatically accelerate.  Values <0, who
  243.                 knows?
  244.             Tag As Variant - General storage for the user.
  245.         Methods
  246.             CreateSprite(Left As Integer, Top As Integer, u As Variant) As Sprite
  247.                 A function which creates a new instance of a sprite of this
  248.                 class, at the given location.  U is passed to the Init event,
  249.                 allowing the user to pass information into that event.  This
  250.                 function returns a reference to the sprite object created.
  251.         Events
  252.                 Init(s As Sprite, u As Variant) - Fired when sprite is first
  253.                     created.  U is the parameter passed to CreateSprite().
  254.                 Tick(s As Sprite) - Fired every s.TickEvt timer ticks.
  255.                 Border(s As Sprite, brd As Border) - Fired when sprite touches
  256.                     a display border indicated by the Brd property.  Calling
  257.                     s.IgnoreMove() during this event will cause the sprite
  258.                     to return to its position it was at before the move which
  259.                     caused this event.
  260.                 Term(s As Sprite) - Called before sprite object is destroyed.
  261.                 LastTerm() - Fired when no more sprites of this sprite class
  262.                     exist.
  263.  
  264.     Sprite Objects
  265.         R/O Properties
  266.             Application - Returns the Application object.
  267.             Parent - Returns the Game object.
  268.             Width As Integer - Width of sprite's graphic in pixels.
  269.             Height As Integer - Height of sprite's graphic in pixels.
  270.         R/W Properties
  271.             Left As Single - Left position in pixels (may be fractional).
  272.             Top As Single - Top position in pixels (may be fractional).
  273.             Vx As Single - Horizontal velocity in pixels per TickMove ticks
  274.                 (may be fractional).
  275.             Vy As Single - Vertical velocity in pixels per TickMove ticks
  276.                 (may be fractional).
  277.             Ax As Single - Horizontal acceleration in pixels per TickMove ticks
  278.                 (may be fractional).
  279.             Ay As Single - Vertical accekeration in pixels per TickMove ticks
  280.                 (may be fractional).
  281.             FrictionX As Single - Horizontal friction.  See description of
  282.                 Friction for SpriteClass (may be fractional).
  283.             FrictionY As Single - Vertical friction.  See description of
  284.                 Friction for SpriteClass (may be fractional).
  285.             Image As Integer - Graphic associated with this sprite.  See
  286.                 SpruuidP.pix and SpruuidP.hh for a list of numbers and their
  287.                 graphics.
  288.             TickMove As Integer - The number of ticks between times the sprite
  289.                 engine move this sprite by Vx and Vy.
  290.             TickEvt As Integer - The number of ticks between SpriteClass_Tick
  291.                 events.
  292.             Visible As Boolean - Indicates whether this sprite is visible or
  293.                 not.  Invisible sprites never cause Collide events.
  294.             Tag As Variant - General storage for the user.
  295.         Methods
  296.             MoveTo(Left As Single, Top As Single) - Move the sprite to the
  297.                 given location.
  298.             MoveBy(Left As Single, Top As Single) - Move the sprite by the
  299.                 given amount.
  300.             Remove() - Destroys the sprite.
  301.             Refresh() - Forces the sprite to repaint, if it is visible.
  302.             IgnoreMove() - Called from within the Collide or Border events
  303.                 to indicate that the move which caused this sprite to collide
  304.                 or touch a border should not be made.
  305.  
  306. //--- EOF -----------------------------------------------------------------
  307.