Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tier 2 GetMemblockPtr Usage

Author
Message
appymedia
9
Years of Service
User Offline
Joined: 24th Jul 2015
Location:
Posted: 8th Jul 2017 08:31
Hi Folks,

Just looking at Tier 2 browsing through the AppGameKit lib header file see a 'GetMemblockPtr' function which appears to return a pointer to the requested memblock. Can I confirm I can use this safely for direct access to memblocks. I have a use case were I will require a lot of changes per-frame to a memblock (200k+ changes) and the existing SetMemBlockXXX functions will be a lot slower.

Also should I be aware of any Tier 1 vs Tier 2 commands or usage differences apart from the obvious language differences?

Thanks All

Great Product

p.s. Rick if you read this I'm the chap who had a good chat to you at EGX a while ago in Sep, taken some time as life happens but looking forward to progressing things now
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 8th Jul 2017 19:28
Hi appymedia. Yes it's safe to use GetMemblockPtr. The memory it points to will be valid until you call agk:eleteMemblock.

In terms of other differences, probably the most obvious thing to be aware of is that when any AppGameKit function returns you a string (char *), you need to delete[] it yourself to avoid a memory leak. Hope that helps!
appymedia
9
Years of Service
User Offline
Joined: 24th Jul 2015
Location:
Posted: 8th Jul 2017 22:16 Edited at: 8th Jul 2017 22:18
Thanks Lucas,

Thats awesome, just been having a play and all works great, nice and speedy . Been 20 years since I did any C/C++ coding of any sort so good call regarding the memory leak advice, forgot a lot! Hoping to use Tier 1 for prototyping things etc and then if I need to for performance reasons reinvent that code using the C++ AppGameKit lib. Love the 1:1 mapping of the functions, in my little play was a doddle to take from Tier 1 to 2.

Peter Edwards (Appy Media)
Jerry McGuire
7
Years of Service
User Offline
Joined: 25th Mar 2017
Location:
Posted: 28th Jul 2017 16:44
Thanks for the advice on memory leaks Lucas!
iMac Book Pro, MacOS 10.12.4, Xcode 8.3.3;
iPhone 6, iOS 9.35; iPhone 5s, iOS 9.35; iPad (3rd gen), iOS 9.35;

Dell Precision T7400, Windows 7 Professional 64bit, Visual Studio Community 2015;

Login to post a reply

Server time is: 2024-09-30 05:26:20
Your offset time is: 2024-09-30 05:26:20