Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.Info
Source: src/com/multiversesocial/hyperview/Info.java, InfoDispatch.java, InfoStep.java, InfoSteps.java
Info is a Gadget in ViewMain (button “ Info ”). Clicking it dispatches into InfoDispatch, a self running demo of the graphics classes: one step at a time, each shown for Info.STEP_MILLIS (4000 ms; change the constant or start Java with -Dinfo.step.millis=2000). Every example is built in code when its step starts. Each step runs in its own nested Dispatch frame, so when the step ends Dispatch.begin() restores the Gob, Gadget, text and line lists and the example is gone.
Skip: Next gadget or Space / Enter / Right arrow / n. Leave: Exit gadget or Escape. After the last step ViewMain is shown again exactly as it was.
Implements: none (Gadget implements HyperConstants)
Helper classes: InfoDispatch extends Dispatch (its inner classes StepFrame, Skip extend Dispatch, InfoKeys extends Gadget); InfoStep (abstract); InfoSteps implements HyperConstants.
| # | Step | Caption on screen | Classes and methods explained |
|---|---|---|---|
| 1 | Info: the graphics demo | Info is a Gadget. Its Dispatch shows one graphics feature at a time and builds each example in code when the step starts. When the step ends, its display dispatch stack frame is restored and the example is gone. Esc = exit, Space = next. Buttons: Next, Exit. | Info, InfoDispatch, InfoStep, InfoSteps, Gadget.addDispatch, Dispatch.begin, Dispatch.run, HyperKeyboard.focus |
| 2 | DBText: text in the view | DBText(view,string,x,y) adds a string to the view's text list (HyperView.addStr). It draws with view.curFont (index into FontBase.fonts[]) and view.fGPen (Palette pen). Set curFont/fGPen first, then create the DBText. Fonts 0..13 are Courier 8..48. | DBText, DBText(HyperView,String,int,int), HyperView.addStr, HyperView.curFont, HyperView.fGPen, FontBase.fonts, FontBase.fontHeight |
| 3 | DBText: pens, flags and live text | view.fGPen selects the text color from the 16 named Palette pens listed on the left. TextConstants flags: THREE_D_ENA adds a shadow. Without CJAM1 the text box is filled with the background pen (textBGPen). The counter below is one DBText, edited in place. | DBText.textFlags, TextConstants.THREE_D_ENA, TextConstants.CJAM1, HyperView.textStr, HyperView.textFlag, HyperView.textBGPen, Palette.color |
| 4 | Palette: the color table | Palette.rgb[][] holds the colors; HyperView.color[i] are the java.awt.Color objects made from it. fGPen/bGPen and the pens of text, lines and Gobs are indexes into that table. Each cell below is a DBText whose background pen (textBGPen) is the index it shows. | Palette, Palette.rgb, Palette.color, HyperView.color, HyperView.bGPen, HyperView.setRGB |
| 5 | FadeText: fading DBText | FadeText extends DBText: FadeText(view,string,x,y,onTimer,repeat,flags) fades in over 11 shades of the pen color, stays onTimer milliseconds, fades out, and does that 'repeat' times before it expires (TextConstants FADE_IN, FADE_OUT, BRIGHTEN_IN, EXPIRE). | FadeText, FadeText(HyperView,String,int,int,int,int,int), TextConstants.FADE_ENA, TextConstants.EXPIRE, DBText.textRestart |
| 6 | Test lines | HyperView.setLocation(x,y) then draw(x2,y2) adds a line to the view's line list. The pen is view.fGPen. Lines live in lineX[], lineY[], lineX2[], lineY2[], so they can be changed at any time: this star rotates by rewriting lineX2[]/lineY2[] every tick. | HyperView.setLocation, HyperView.draw, HyperView.DBVectorDraw, HyperView.lineX, HyperView.lineColor, HyperView.totalLines, HyperLine, HyperView.writePixel, Pixel |
| 7 | Circles | Circle(view,radius,points) computes x[]/y[] on a circle (box 0..2r) and, through HyperView.addCircle, builds HyperLine segments in Circle.line[]. A Circle is only a set of lines: Info moves them to a center and calls addLine(HyperLine) to show them. | Circle, Circle(HyperView,double,int), Circle.destroy, HyperView.addCircle, HyperView.addLine, HyperLine |
| 8 | Gobs: graphic objects | A Gob is an image with a position: new Gob(view,imageName,w,h,x,y,flags); then view.addGob(gob). The image is loaded from the codebase URL. move(x,y) places it, enable()/disable() show or hide it (GOB_ON_DISPLAY). Five Gobs bounce here, 'duke' blinks. | Gob, Gob(HyperView,String,int,int,int,int,int), HyperView.addGob, Gob.move, Gob.enable, Gob.disable, Gob.remove, HyperConstants.GOB_ON_DISPLAY |
| 9 | Memory image Gobs | A Gob needs no image file: new Gob(view,int[] pixels,w,h,flags) wraps a java.awt.image.MemoryImageSource built from ARGB pixels computed in code (here a radial gradient with alpha). Gob.gobFlags2 GOB_MEMORYIMAGESOURCE marks them. | Gob(HyperView,int[],int,int,int), Gob(HyperView,MemoryImageSource,int,int,int), java.awt.image.MemoryImageSource, Gob.isMemoryImageSource |
| 10 | AnimGobs: animated sprites | An AnimGob is a sprite: a sprite sheet strip (one image, all frames side by side) played at setFPS(). AnimGob(view,name,ext,x,y,sheetW,cellH,clips) adds itself to the Gob list. Below: the strips used by the solar system demo plus world_anim.gif, each looping. | AnimGob, AnimGob(HyperView,String,String,int,int,int,int,int), AnimGob.setFPS, AnimGob.start, AnimGob.stop, AnimGob.getCurrentFrame |
| 11 | AnimGob: playback controls | AnimGob can flip (setHorizontalFlip/setVerticalFlip), tint (setTint(color,intensity)), play a frame range (setFrameRange), ping-pong, reverse, play once (setLoop(false)) and report frames to an AnimFrameListener. Labels show the calls used on each earth. | AnimGob.setHorizontalFlip, AnimGob.setVerticalFlip, AnimGob.setTint, AnimGob.setFrameRange, AnimGob.setPingPongMode, AnimGob.reverse, AnimGob.setLoop, AnimGob.setFrameListener, AnimGob.AnimFrameListener, AnimGob.getCurrentFrame, AnimGob.isPlaying |
| 12 | Nested orbit AnimGobs (V3.21) | Gob.addOrbitGob(child,radius,speed,ra,dc) makes a child Gob orbit its parent, and the child can have orbit children. Sun <- Mercury, Earth, Mars. Earth <- Moon <- Rocket, nested like the Cont strips. Z order between them is sorted by HyperView.orbitTick(). | Gob.addOrbitGob, Gob.z, Gob.widthBase, AnimGob, HyperView.orbitTick, HyperView.bubbleGobZ |
| 13 | Spline: CURVE_LINEAR | Spline(view,speed,x[],y[],z[],curveType,flags): points in double, a path the Gob follows 'speed' pixels per frame ALONG the path (arc length, so constant). Exact position: Gob.fx/fy (double); x,y are rounded. CURVE_LINEAR = straight segments, grey = polygon. | Spline(HyperView,double,double[],double[],double[],int,int), Spline.CURVE_LINEAR, Spline.getSpeed, Spline.getLength, Spline.getPointAtLength, Spline.step, Spline.getPathX, Gob.fx, Gob.getFloatX, Gob.setFloatPosition, Gob(HyperView,String,int,int,Spline,int), Spline.toString |
| 14 | Spline: CURVE_BEZIER (a real curve) | CURVE_BEZIER: one cubic Bezier per segment through the points; the handles come from the neighbouring points (setBezierHandles = your own). Before 3.2 the Gob moved on straight segments whatever the type. White = the curve (PATH_LINE_ENA). | Spline.CURVE_BEZIER, Spline.setBezierHandles, Spline.getPointOnSegment, Spline.getArcLengthTable, Spline.getCurveType, Spline.PATH_LINE_ENA |
| 15 | Spline: CURVE_CATMULL_ROM (a real curve) | CURVE_CATMULL_ROM: uniform Catmull-Rom through the points (end points duplicated). Same six points as the Bezier step: compare the two curves and the lengths printed below. The speed is constant on both: the path is sampled into an arc length table. | Spline.CURVE_CATMULL_ROM, Spline.getPointOnSegment, Spline.setSamplingResolution, Spline.getCurveType, SplineConstants.PATH_LINE_ENA |
| 16 | Spline.createCircle (closed) | Spline.createCircle(view,cx,cy,radius,points,speed[,flags]) is a CLOSED Bezier through 'points' points. Default flags WRAP_AT_END|SP_ZBUFFER_ENA (it used to have no end logic). Here flags = WRAP_AT_END: a full size Gob going round forever, seamlessly. | Spline.createCircle, Spline.setClosed, Spline.flags, SplineConstants.WRAP_AT_END, SplineConstants.SP_ZBUFFER_ENA |
| 17 | Spline.createEllipse (closed) | Spline.createEllipse(view,cx,cy,rx,ry,points,speed[,flags]): the same with two radii. Closed, floating point, WRAP_AT_END by default (plus the z encoding unless the flags say otherwise). The speed is the same everywhere on the ellipse, bends and straights. | Spline.createEllipse, Spline.isClosed, Spline.flags |
| 18 | Spline.createSpiral | Spline.createSpiral(view,cx,cy,startR,endR,turns,points,speed[,flags]): an open Bezier from startR to endR. Default end logic BOUNCE_AT_END (the factory used to set none and the Gob stopped): out and back again, at constant speed through the turn. | Spline.createSpiral, SplineConstants.BOUNCE_AT_END, Spline.getDirection |
| 19 | Spline.createHeart (closed) | Spline.createHeart(view,cx,cy,size,speed[,flags]): a closed Bezier through 32 points of the heart curve, WRAP_AT_END by default. All four create...() factories return ordinary Splines: reverse(), translate(), scale(), setSpeed() still work. | Spline.createHeart, SplineConstants.WRAP_AT_END, Spline.translate, Spline.scale, Spline.reverse, Spline.setSpeed |
| 20 | Gob.attachSpline, detachSpline, float position | Gob.attachSpline(s): the Gob follows s (GOB_SPLINE_ENA), getSpline() returns it, detachSpline() lets go on the spot. Each frame HyperView calls Spline.step(gob): fx,fy are doubles; x,y = round(fx),round(fy). B (0.35 px/frame) shows sub pixels. | Gob.attachSpline, Gob.setSpline, Gob.getSpline, Gob.detachSpline, Gob.setFloatPosition, Gob.getFloatX, Gob.getFloatY, Spline.step, Spline.advance, Spline.setSpeed, Spline.getDistance, Spline.getLength, Gob.fx, Gob.fy, HyperConstants.GOB_SPLINE_ENA |
| 21 | Spline end logic: STOP_AT_END | STOP_AT_END (also when no END_LOGIC flag is set): the Gob is put exactly on the end point and lets go of the Spline (GOB_SPLINE_ENA off, Gob.spline null), as before 3.2. The text below shows the live Spline state until it lets go. | SplineConstants.STOP_AT_END, SplineConstants.ARRIVED, Spline.advance, Spline.ADV_FINISHED, Spline.getFlagString, Gob.getSpline, Gob.detachSpline |
| 22 | Spline end logic: BOUNCE_AT_END | BOUNCE_AT_END: the distance folds back at the end (d = 2*length - d): the Gob turns round with no stall and no change of speed, SP_FORWARD is cleared while it goes back, and the same at the start. The overshoot of the frame is carried over (floating point). | SplineConstants.BOUNCE_AT_END, SplineConstants.SP_FORWARD, Spline.advance, Spline.getDirection |
| 23 | Spline end logic: COLLIDE_AT_END | COLLIDE_AT_END: each frame the Gobs with it are tested (CollisionManager.collide). Outline = Gob.setOutline(Polygon), default the box. Box reject, then pointInPoly(). On contact: GOB_COLLIDED, collisionCount, collidedWith and a CollisionAnimGob. | SplineConstants.COLLIDE_AT_END, CollisionManager, CollisionManager.collide, CollisionManager.pointInPoly, CollisionAnimGob, Gob.setOutline, Gob.collidesAtEnd, Gob.isCollided, Gob.getCollisionCount, Gob.getCollidedWith, HyperConstants.GOB_COLLIDED |
| 24 | GOB_COLLISION_OUTLINE: outline from the image | setImageOutlineEnabled(true) = flag GOB_COLLISION_OUTLINE: the first collision pass traces the outline from the image: opaque pixels, outer contour, holes ignored. C (on a Bezier Spline) dips into L's notch: boxes overlap, shapes do not. Then hits P. | HyperConstants.GOB_COLLISION_OUTLINE, Gob.setImageOutlineEnabled, Gob.isImageOutlineEnabled, Gob.takesPartInCollisions, Gob.computeImageOutline, Gob.hasImageOutline, Gob.getImageOutlineRawPoints, Gob.getOutlineComputeCount, Gob.outlineComputeCount, Gob.outlineAlphaMin, Gob.outlineEpsilon, Gob.outlineMaxPoints, OutlineTracer, OutlineTracer.trace, OutlineTracer.Result, CollisionManager.collide, CollisionManager.pointInPoly, Gob.getOutline, Gob.invalidateImageOutline |
| 25 | Gob.angle: rotation, outline turns too | Gob.setAngleDegrees(a) / setAngle(radians): clockwise, about the Gob's centre. Angle 0 = the old drawImage path. Else nearest or bilinear, alpha is kept. The outline (orange) is traced from the alpha, turns with the Gob and scales with z. Spin = angle added per step. Yellow = the selected Gob's polygon. | Gob.angle, Gob.setAngle, Gob.getAngle, Gob.setAngleDegrees, Gob.getAngleDegrees, Gob.rotateBy, Gob.setRotateInterpolation, Gob.getRotateInterpolation, Gob.ROTATE_NEAREST, Gob.ROTATE_BILINEAR, Gob.setSpin, Gob.getSpin, Gob.drawRotated, GobGeometry, GobGeometry.updateOutlineRotated, GobGeometry.worldPolygon, GobGeometry.rotate, CollisionManager.updateOutline, HyperView.selectGob, HyperView.selectColor |
| 26 | Collisions: bounce, stick, hit points, explosion | Gob.setPhysics(mass,restitution,response): BOUNCE or STOP. Velocity vx,vy is in pixels per step. Momentum is kept; restitution 0 = they go on together. Damage = impact energy. setHitPoints(n): at 0 it explodes and is removed. STOP = 'ball in sand'. A Spline moves a Gob until its first bounce. | Gob.setPhysics, Gob.setMass, Gob.getMass, Gob.setRestitution, Gob.getRestitution, Gob.setResponse, Gob.getResponse, Gob.RESPONSE_NONE, Gob.RESPONSE_BOUNCE, Gob.RESPONSE_STOP, Gob.setVelocity, Gob.getVelocityX, Gob.getVelocityY, Gob.setPhysicsMotion, Gob.resumeSpline, Gob.isPhysicsOwned, Gob.isHalted, Gob.isDynamic, Gob.vx, Gob.vy, Gob.setHitPoints, Gob.getHitPoints, Gob.getMaxHitPoints, Gob.setDamageFactor, Gob.getDamageFactor, Gob.damage, Gob.explode, Gob.onExplode, Gob.isExploded, Gob.getLastImpactEnergy, Gob.getLastImpactSpeed, Gob.getImpactCount, Gob.getLastImpactFrom, CollisionManager.respond, CollisionManager.contactNormal, CollisionManager.explode, CollisionManager.walls, CollisionManager.damageScale, CollisionManager.damageThreshold, CollisionManager.wallLeft, CollisionAnimGob |
| 27 | Click to select: HyperView.pickGob | pickGob(x,y): the topmost Gob under a pixel (drawn last wins). Not Gadgets. A Gob with the outline flag is hit by its ALPHA: the ring's hole lets the click through to the box. Rotation and z are respected. pickOnClick: click = select. Selected = yellow outline; onSelect / onDeselect / GobPickListener report it. | HyperView.pickGob, HyperView.pickGobs, HyperView.pickAndSelect, HyperView.selectGob, HyperView.getSelectedGob, HyperView.clearSelection, HyperView.pickOnClick, HyperView.selectColor, HyperView.GobPickListener, HyperView.pickListener, Gob.containsPoint, Gob.setPickable, Gob.setPickAlpha, Gob.onSelect, Gob.onDeselect, Gob.onPick, Gob.isSelected, GobGeometry.containsPoint, HyperMouse |
| 28 | Spline end logic: WRAP_AT_END | WRAP_AT_END: d -= length at the end, the overshoot is kept. An OPEN path (this one) jumps from the last point to the first; a CLOSED one (circle, ellipse, heart) is seamless. A straight 3 point path is used so the restart is easy to see. | SplineConstants.WRAP_AT_END, Spline.advance, Spline.getDistance, Spline.reset |
| 29 | Spline: SP_ZBUFFER_ENA (z depth) | SP_ZBUFFER_ENA: the Spline has a z for every point; z runs along the same curve (double) and the Gob's width = widthBase / z uses it, so the size changes smoothly. z = 1 is full size, bigger is farther away (Gob.gobZInit, ZBUFFER_ENA). | SplineConstants.SP_ZBUFFER_ENA, Gob.gobZInit, Gob.widthBase, Gob.getFloatZ, HyperConstants.ZBUFFER_ENA, Spline.ZBufferEna, Spline.ZBufferDisable |
| 30 | Preferences pane | PreferencesPane (a BasicPane, which is a Gadget) holds the user's settings: GetString text fields for account, directories, host, port and the IO class names, RadioButtons, and Load/Save/Restore gadgets. Main menu 'Preferences' opens it with GetPrefs. | PreferencesPane, GetPrefs, BasicPane, GetString, RadioButton, HyperView.setTitle |
| 31 | Gobs and Gadgets are named by URL | A Gob/Gadget image name is resolved against HyperView.getCodeBase() (a URL; set with -Dcodebase=<url>): new URL(codeBase,name). An absolute URL as the name works the same. Only images (Gob, Gadget, AnimGob, background) and sounds load by URL, not the objects. | HyperView.getCodeBase, HyperView.createURL, Gob.gobName, Gadget.makeBitMap, ImageGadget, AnimGob, HyperView.setBackImage, SoundClip |
| 32 | Background images and the Titlebar | HyperView.setBackImage(name) loads a full view background image (640x480). setTitle(text) creates the Titlebar Gob (it shows the title, version and clock). Both are part of the backed up display: this step changes them and the previous ones return afterwards. | HyperView.setBackImage, HyperView.setTitle, Titlebar, HyperView.setTitlebar, HyperView.backImageName |
| 33 | Gadgets: buttons that dispatch | A Gadget is a Gob drawn as a button: new Gadget(view," name ",x,y). addDispatch(d) attaches a Dispatch; a click makes HyperView call d.begin(). ImageGadget draws an image button. Info 'clicks' the left button itself every second (same code path). | Gadget, Gadget(HyperView,String,int,int), Gadget.addDispatch, ImageGadget, Dispatch, HyperView.dispatchedGad, HyperConstants.DISPATCH_ENA |
| 34 | ViewPane: a window you draw into | ViewPane(view,x,y,w,h) is a Gadget with its own off-screen Image and java.awt.Graphics (ViewPane.graphics). drawString(), erase() and any AWT call draw into it; HyperView composites it with the other Gobs. Asteroids (the game) is a ViewPane. | ViewPane, ViewPane.graphics, ViewPane.drawString, ViewPane.erase, ViewPane.setTitle, BasicPane, Gob.gobPic |
| 35 | Double buffered AWT views | HyperView is an AWT component (Orange extends java.awt.Component). Each frame is drawn into the off-screen screenImage (screenGraphics), then blitted to the window. USE_BLIT_OPTMIZE copies just the damaged rectangle; BUFFER_STRATEGY_ENA uses a java.awt.image.BufferStrategy. The ViewPane below is one more off-screen Image. | HyperView.screenImage, HyperView.screenGraphics, HyperConstants.USE_BLIT_OPTMIZE, HyperConstants.ERASE_VIEW, HyperConstants.BUFFER_STRATEGY_ENA, HyperView.bufferStrategy, AWTEventManager, AWTViewLink, Orange, HyperView.iteration |
| 36 | Display dispatch stack | Dispatch.begin() backs up the Gob, Gadget, text and line lists, the Titlebar, background and keyboard focus, runs the Dispatch, then restores them. This frame builds Gobs, goes into frame B, which builds others and goes into C. On return the lists are compared. | Dispatch.begin, Dispatch.run, Dispatch.cleanUp, HyperConstants.INHERIT_GADGETS, HyperConstants.INHERIT_LINES, HyperView.runView, HyperView.gob, HyperView.gads, HyperView.textStr, HyperView.lineX, HyperView.runStack |
| Class | Steps |
|---|---|
AWTEventManager | 35 |
AWTViewLink | 35 |
AnimGob | 10, 11, 12, 31 |
BasicPane | 30, 34 |
Circle | 7 |
CollisionAnimGob | 23, 26 |
CollisionManager | 23, 24, 25, 26 |
DBText | 2, 3, 5 |
Dispatch | 1, 33, 36 |
FadeText | 5 |
FontBase | 2 |
Gadget | 1, 31, 33 |
GetPrefs | 30 |
GetString | 30 |
Gob | 8, 9, 12, 13, 20, 21, 23, 24, 25, 26, 27, 29, 31, 34 |
GobGeometry | 25, 27 |
HyperConstants | 8, 20, 23, 24, 29, 33, 35, 36 |
HyperKeyboard | 1 |
HyperLine | 6, 7 |
HyperMouse | 27 |
HyperView | 2, 3, 4, 6, 7, 8, 12, 25, 27, 30, 31, 32, 33, 35, 36 |
ImageGadget | 31, 33 |
Info | 1 |
InfoDispatch | 1 |
InfoStep | 1 |
InfoSteps | 1 |
Orange | 35 |
OutlineTracer | 24 |
Palette | 3, 4 |
Pixel | 6 |
PreferencesPane | 30 |
RadioButton | 30 |
SoundClip | 31 |
Spline | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 28, 29 |
SplineConstants | 15, 16, 18, 19, 21, 22, 23, 28, 29 |
TextConstants | 3, 5 |
Titlebar | 32 |
ViewPane | 34 |
| Class | Reason |
|---|---|
AnimationConstants | interface of two flag constants (ANIM_LOADED, COLLISION_ENA); no step needs them |
BitmapConstants | interface with one flag constant (MEMORYIMAGE_ENA) |
LineConstants | flag constants of HyperLine (VECTOR_ENA is tested by the renderer but its movement is a Todo) |
FontBaseButton | a button that opens FontPane; needs interaction |
FontPane | font chooser pane; needs interaction |
Image2RGB | tool Dispatch with its own gadget in ViewMain (Image2RGB); reads an image into pixel data |
MemoryImageButton | a Gadget showing a memory image; the Memory image Gobs step shows the Gob itself |
MemoryImageGobDispatch | ViewMain's own MemoryImage Gob() gadget; Info builds its own |
MemoryImageGobPane | pane used by MemoryImageGobDispatch |
Scanline | pixel collision mask of a Gob (GOB_COLLISION_ENA, Gob.initScanline, Gob.collisionOn); no step shows it. The collision steps use outline polygons instead (hand set or traced from the image by OutlineTracer), not this mask |
SplineEditDispatch | interactive Spline editor (ViewMain gadget SplineEdit); needs the mouse |
SplineEditPane | pane of the Spline editor; needs the mouse |
SuperBitmap | bitmap Gadget base of the console; no step |
SuperBitmapConsole | console bitmap; ViewMain's NCLI TextPane is the example |
TextPane | scrolling text console (ViewMain's NCLI pane); no step |
StateDispatch | state machine dispatch; networking, not graphics |
AudioClip | sound; there is no audio output on the machine the demo was tested on |
HyperScrollbar | scroll bar Gadget; no step |
CURVE_LINEAR, CURVE_BEZIER and CURVE_CATMULL_ROM are real curves now. Before, the Gob moved on straight, octant snapped segments whatever the type (the Bezier control points were computed but never read); now Spline samples the curve into an arc length table and HyperView.run() calls Spline.step(gob), which moves the Gob speed pixels per frame along the curve in floating point (Gob.fx/fy; x,y are those rounded). Attach a Spline with Gob.attachSpline(), release it with detachSpline().COLLIDE_AT_END is a Spline end mode implemented with CollisionManager: the Gob stops exactly on its last point, the Spline stays attached and the Gob keeps taking part (combined with WRAP/BOUNCE it keeps moving). Every display frame HyperView.collisionPass() tests the participating Gobs of the current Dispatch frame against each other: bounding box, then point-in-polygon on the outline. The outline is, in this order, a polygon set with Gob.setOutline(), the polygon traced from the Gob's image if the Gob has the flag GOB_COLLISION_OUTLINE (Gob.setImageOutlineEnabled(true)), or the bounding box. The flag also makes a Gob a participant without any Spline; only flagged Gobs are ever traced (Gob.getOutlineComputeCount() proves it). Nothing is moved or stopped on contact; the Gobs get GOB_COLLIDED, collisionCount, collidedWith and a CollisionAnimGob impact animation at the contact point (the impact sprite is generated in code: the shipped media has none).CollisionManager also tests edge crossings (CollisionManager.edgeTest, default true). Points exactly on an edge count as inside.createCircle/createEllipse (closed, WRAP_AT_END | SP_ZBUFFER_ENA by default, z swings 10 -/+ 4 as a double), createSpiral (open, BOUNCE_AT_END) and createHeart (closed, WRAP_AT_END) now set their end logic; each has an overload with explicit flags that replaces the default. Before 3.2 the circle and ellipse set the z flag but no end logic, so the Gob stopped at the end unless the caller set one.STOP_AT_END (or no END_LOGIC flag) still detaches the Spline when the Gob reaches the end (the Gob stays on the end point); direct edits of the old int arrays Spline.x[] no longer move the Gob (use setPoints/translate/scale/addPoint); a Spline whose points are all the same never moves its Gob; one Spline belongs to one Gob.new Circle(view,r,n) only builds HyperLine objects; they are drawn once passed to HyperView.addLine().new Gob(...) does not add itself to the view (call view.addGob(gob)); an AnimGob constructor does add itself.DBVectorDraw() stores a target line and a speed; the renderer has a Todo for moving lines, so only the start line is drawn.new URL(getCodeBase(),name); -Dcodebase=<url> changes the base. Objects themselves are not loaded by URL.INHERIT_LINES flag, new in this version); before that fix a dispatched frame inherited and left behind lines.public class Info extends Gadget
| Signature | Description |
|---|---|
static final int STEP_MILLIS | Time each step is shown, in milliseconds. Default 4000; -Dinfo.step.millis=N overrides it. |
| Signature | Description |
|---|---|
Info(HyperView tView, int tX, int tY) | Makes the “ Info ” Gadget at tX,tY, adds an InfoDispatch and shows it (GOB_ON_DISPLAY). ViewMain.main() creates one at 201,116. |
| Member | Description |
|---|---|
SLICE_MILLIS | runView() slice and tick rate of a step (100 ms). |
DEMO_TOP, DEMO_BOTTOM | Pixel rows free for the example (112 to 440). |
text(), setText(), gob(), line() | Helpers: add a DBText (returns its slot in the view text list), change it in place, add a Gob, add a line. |
stepNum, errors, stepsRun, finished | Static state read by the test (InfoRunTest). |
Compile with compile27 or this single plain line (javac on the PATH, no environment variables) : javac -encoding US-ASCII -d build/classes -cp lib/comm.jar -sourcepath src src/com/multiversesocial/hyperview/*.java. Run ViewMain and click “ Info ”. The test test/com/multiversesocial/hyperview/InfoRunTest.java starts ViewMain, clicks Info, saves a screenshot of every step, checks no step threw, the dispatch stack step reports all lists restored, and that Next, Space and Escape work (run it on a display, for example under Xvfb). It also checks the spline steps (the three curve types have three different lengths, the STOP step lets go of the Spline), the attach/detach step (sub pixel fx while x is an int), the COLLIDE_AT_END step (the Gobs get flagged, collide, the impact animation is drawn) and the image outline step (3 traces for the 3 flagged Gobs, none for the Gob without the flag; the circle's box overlaps the L's box without a collision, then it hits the plus sign). test/com/multiversesocial/hyperview/CollisionTest.java tests CollisionManager.pointInPoly and the collision pass itself (flags, counters, the CollisionAnimGob, no spurious or recursive collisions, nested Dispatch frames). SplineTest.java tests the curve math (Bezier and Catmull-Rom at known t, arc length, constant speed, the four end modes with fractional speeds), attach/detach and the movement in the real display loop. OutlineTest.java tests OutlineTracer on known shapes, the flag gating (the compute counter), and collisions between outlined Gobs whose boxes overlap but whose shapes do not.