SmileBASIC 4 Discussion「プチコン4」
Yeah but I kind of want the text to scroll to the left. Maybe I can come up with a way to make 0,0 be the bottom right? idkMy current method for scrolling involves using SCROLL to shift the current text-screen contents in the opposite direction of where I'm scrolling, and then filling in the empty section made from the shift with the proper information from my map data. I keep track of the actual position, but also use variables that keep track of the offset on the X/Y axis, limiting it to within the area of the tilesize. This offset is what I use with TOFS. If this offset is < 0 or >= tilesize, then I either add/subtract the tilesize, shift the TS contents, then fill in the new map information. Right now, I'm trying to find a better method for filling in the new information, as filling in one tile at a time is processing that could be spent elsewhere. Filling in the information when scrolling vertically is easy enough because of how arrays are arranged, but horizontally is different.
Since TARRAY() is two-dimensional, you may be able to use RINGCOPY to copy in vertical data. You'll have to put the data you're copying into an array with first dimension equivalent to the height of the text screen.Yeah but I kind of want the text to scroll to the left. Maybe I can come up with a way to make 0,0 be the bottom right? idkMy current method for scrolling involves using SCROLL to shift the current text-screen contents in the opposite direction of where I'm scrolling, and then filling in the empty section made from the shift with the proper information from my map data. I keep track of the actual position, but also use variables that keep track of the offset on the X/Y axis, limiting it to within the area of the tilesize. This offset is what I use with TOFS. If this offset is < 0 or >= tilesize, then I either add/subtract the tilesize, shift the TS contents, then fill in the new map information. Right now, I'm trying to find a better method for filling in the new information, as filling in one tile at a time is processing that could be spent elsewhere. Filling in the information when scrolling vertically is easy enough because of how arrays are arranged, but horizontally is different.
You can access a multidimensional array like a singledimensional array, for example:I should have been more specific. There are commands that can utilize both 1D and 2D arrays, and while I have a 2D array, I'd like the commands to utilize it like a 1D array, as it would handle it differently.VAR ARR[4,4] ARR[8]=1 'this is equivalent to ARR[2,0]=1
Yeah, how can I use COPY on an array? I've tried experimenting with RINGCOPY, and I can't get it to work.RINGCOPY has various limitations. Firstly, if both destination and source are 2D, they must have the same number of channels (first dimension). Also, I believe the source offset + number of elements to copy has to be less than or equal to the number of elements in the 2nd dimension. Probably other restrictions.
Funny how one looks at various instructions, and think of ways to use them for a particular function as if they are the best means for it, to then spend hours mulling, coding, and testing only to have a solution that doesn't use those instructions. That's how it is for me when working on a wrap-around map solution. Tried using SCROLL and RINGCOPY in different ways, but either the code just to fill the gaps became too complex to be worthwhile (SCROLL), or copying large amounts of data took too long with very large map arrays when most of it would not be used (RINGCOPY + COPY). I finally settled with a middle ground that was both simple, and didn't deal with as much data. So simple that I wonder why it wasn't the very first method I'd have thought up. Incorporated it into my tunnel demo.
https://twitter.com/DiscostewMC/status/1257460706972229637
Oh yeah. A couple days ago I was working on my graphics library, trying to get a horizontal/vertical inversion function going. I started messing around with GCOPY operations, but then I remembered that if you RSORT an empty [0,0,0,0,...] array along with a result-sorted array, the result-sorted array is reversed. So, solution: GSAVE rows and columns of the area of the graphics page to reverse, RSORT their image arrays, and GLOAD them back to the screen.
Spent about an hour trying to figure out why my original code wouldn't flip even-pixeled regions the same as odd-pixeled regions only to remember this and solve the issue in 5 minutes.
So using COPY 15-45 times every second doesn’t really work, because that drops the speed from 60 FPS to 3 FPS. That’s not a joke. I really don’t know how to make working BG movement at this point. Maybe I’ll read through this thread to find out. I’m thinking about trying TOFS, then finding some way to combine 2 arrays when you approach multiples of 128. But I can’t think of any way to do that without slowing the entire thing down.