Hi:
What commands are used to MemBlocks?
What are the Memblocks?
The other problem I have is that the videos I try to play with CoolBasic do not play, you hear only the audio but not see the image.
How can you see that video?
Thank you.
Help with MemBlocks and Videos
-
- Tech Developer
- Posts: 545
- Joined: Sun Aug 26, 2007 2:43 pm
- Location: Liminka
Re: Help with MemBlocks and Videos
1. What commands are used to MemBlocks?Hacker wrote:Hi:
What commands are used to MemBlocks?
What are the Memblocks?
The other problem I have is that the videos I try to play with CoolBasic do not play, you hear only the audio but not see the image.
How can you see that video?
Thank you.
MakeMemBlock(size) - Creates memory block which is (size) bytes long.
MemBlockSize(memblock) - Tells size of memory block (memblock)
DeletememBlock(block) - Deletes memory block (block)
ResizeMemBlock(block, size) - Resizes memory block (block) to (size) bytes
PokeByte() - Puts one byte to memory block
PokeShort() - Puts two bytes to memory block
PokeInt() - Puts four bytes to memory block
PokeFloat() - Puts fourd bytes to memory block
PeekByte() - Reads byte from memory block
PeekShort() - Reads 2 bytes from memory block
PeekInt() - Reads 4 bytes from memory block
PeekFloat() - Reads 4 bytes from memory block
2. What are the Memblocks?
Memory Blocks are pieces of computer's memory which you can access to store data.
3. How can you see that video?
You are propably missing some codec that's needed to play the video. Try installing divX.
CoolBasic henkilökuntaa
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Re: Help with MemBlocks and Videos
Thank You!!
But how do you use MemBlocks?
Someone can give me a piece of code as example?
Please do not understand.
Thanks in advance.
But how do you use MemBlocks?
Someone can give me a piece of code as example?
Please do not understand.
Thanks in advance.
-
- Tech Developer
- Posts: 545
- Joined: Sun Aug 26, 2007 2:43 pm
- Location: Liminka
Re: Help with MemBlocks and Videos
Okay, here's my quickly written small example of memory blocks. Memory blocks are useful when you need to pass data to functions or dlls but otherwise they are not needed so much.
Code: Select all
//Memory block example
mem = MakeMEMBlock(11) // Create 12 bytes long memory block
PokeInt mem, 0, 65912 // Put number to location 0 (4 bytes long number)
PokeShort mem, 4, 2000 // Put another number to location 4 (2 bytes long number)
PokeByte mem, 6, 123 // Yet another number to location 6 (one byte long number)
PokeFloat mem, 7, 127.001 // Now we put floating point number to location 7 (4 bytes long number)
Print PeekByte(mem, 6) // Read number from our memory block from location 6. The location must be some place where you have put data
Print PeekInt(mem, 0)
Print PeekFloat(mem, 7)
Print PeekShort(mem, 4)
DeleteMEMBlock mem // Release the memory. CoolBasic should automagically clean up non deleted memory blocks but you never know :)
WaitKey
CoolBasic henkilökuntaa
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Re: Help with MemBlocks and Videos
Jea, but with MemBlocks you can also make a replacing structure for arrays and types. Though that is rarely needed to do, but sometimes it proves to be quite handy. Or if not replacing types and arrays, you can also use MemBlocks to extend their potentiality.KilledWhale wrote:Okay, here's my quickly written small example of memory blocks. Memory blocks are useful when you need to pass data to functions or dlls but otherwise they are not needed so much.
Re: Help with MemBlocks and Videos
Thank You!!!
-
- Tech Developer
- Posts: 545
- Joined: Sun Aug 26, 2007 2:43 pm
- Location: Liminka
Re: Help with MemBlocks and Videos
But as an array, calculating writing and reading positions can be a bit slower than using regular arrays which isn't good especially when talking about CoolBasic. Using memory block instead of array can cost many valuable opcodesJare wrote:Jea, but with MemBlocks you can also make a replacing structure for arrays and types. Though that is rarely needed to do, but sometimes it proves to be quite handy. Or if not replacing types and arrays, you can also use MemBlocks to extend their potentiality.KilledWhale wrote:Okay, here's my quickly written small example of memory blocks. Memory blocks are useful when you need to pass data to functions or dlls but otherwise they are not needed so much.
CoolBasic henkilökuntaa
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Kehittäjä
cbFUN Kello
cbSDL
Whale.dy.fi
<@cce> miltäs tuntuu olla suomen paras
Re: Help with MemBlocks and Videos
But, what if you need to specify an array as type's field. This where memblocks come in handy.KilledWhale wrote:But as an array, calculating writing and reading positions can be a bit slower than using regular arrays which isn't good especially when talking about CoolBasic. Using memory block instead of array can cost many valuable opcodesJare wrote:Jea, but with MemBlocks you can also make a replacing structure for arrays and types. Though that is rarely needed to do, but sometimes it proves to be quite handy. Or if not replacing types and arrays, you can also use MemBlocks to extend their potentiality.KilledWhale wrote:Okay, here's my quickly written small example of memory blocks. Memory blocks are useful when you need to pass data to functions or dlls but otherwise they are not needed so much.
Re: Help with MemBlocks and Videos
That would usually be the best solution. I really like it this way.Sly_Jack0 wrote: But, what if you need to specify an array as type's field. This where memblocks come in handy.
But another way is to make a large multidimension array and every type instance having their own unique index to the array's first dimension. Yes, it has its limits such as predefined maximum count of type instances (or need for resizing the array when a new instance is created) and unable to pass array to functions as a parameter. But the advantage here is absolutely the speed.
So my point is: there are choices. Try to select one that suits best for a certain issue.