Request: Hooks for file saving/loading
BlitzMax Forums/BlitzMax Module Tweaks/Request: Hooks for file saving/loading
| ||
BRL could you possible add a hook in each of the image loaders/savers so that `SAVEPROGRESS` `LOADPROGRESS` or `PROGRESS` events are generated while the image is being loaded or saved, so us programmers can then create an appropriate progress indicator? I realize this would mean the loader/saver would have to be paused while the hooks are run. |
| ||
Good idea. |
| ||
It's maybe better to use a StreamWrapper instead of altering the image loaders: Link: ProgressStream This should work with all load and save functions that accept a stream as source. -- Byteemoz |
| ||
No idea how to do that, and nor do most people. An event would be easier. |
| ||
No idea how to do that, and nor do most people There's an article included with BMax which explains how to do this. It's labelled as 'advanced', but it's really pretty simple..."BlitzMax tutorials and articles>Writing custom stream handlers" You could just use the code Byteemoz has linked to, of course. ;o) |
| ||
An event would be easier. Then replace the Progress() method in TProgressStream with Method Progress() EmitEvent CreateEvent(EVENT_STREAMPROGRESS, _stream, 0, 0, _readcount, _writecount, ProgressContext) EndMethodand define the EVENT_STREAMPROGRESS constant. The event then contains: EventSource() = the stream EventX() = read bytes EventY() = written bytes EventData() = progress context (optional) -- Byteemoz |