|
Forum Index : Microcontroller and PC projects : Why this error (PicoMite)?
| Author | Message | ||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3609 |
> run [47] Line SX(-24), SY(34), SX(24), SY(34), 1, cTrack Error : Dimensions Error doesn't occur when SX parameter is not negative. > Line SX(0), SY(34), SX(24), SY(34), 1, cTrack (Above command correctly draws line) ======================= > list Option Explicit Option Default Float Dim Float Scale Dim Integer OffX, OffY ' --- Color Palette --- Dim Integer cTrack = RGB(255, 255, 255) ' --- Setup & Draw --- InitScale CLS RGB(0, 0, 0) DrawMainline ' Keep program running to hold display Do Loop ' ==================================================================== ' RENDERING ENGINE ' ==================================================================== Sub InitScale Local Float scaleX = MM.HRES / 100.0 Local Float scaleY = MM.VRES / 90.0 If scaleX < scaleY Then Scale = scaleX Else Scale = scaleY OffX = (MM.HRES - (96 * Scale)) / 2 OffY = (MM.VRES - (72 * Scale)) / 2 End Sub Function SX(x As Float) As Integer SX = OffX + (x + 48) * Scale End Function Function SY(y As Float) As Integer SY = OffY + (36 - y) * Scale End Function ' ==================================================================== ' GEOMETRY DRAWING ' ==================================================================== Sub DrawMainline Line SX(-24), SY(34), SX(24), SY(34), 1, cTrack Line SX(-24), SY(-34), SX(24), SY(-34), 1, cTrack Line SX(-46), SY(12), SX(-46), SY(-12), 1, cTrack Line SX(46), SY(12), SX(46), SY(-12), 1, cTrack End Sub > ~ Edited 2026-02-15 04:05 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10953 |
It first assumes sx is an array and fails on the negative array index. I'll fix in the next beta |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |