Do you know from where this is being called/linked? I've never seen that error as a missing function before, but I know you're working on porting something that comes from a different platform. If I can get a super minimal repro case I may be able to add it to the boilerplate and have it not be completely broken either.
check if there isn't a srand(Time(null)) somewhere, the time functions do not work on playdate as far as i'm aware and you need to use the playdate equivalents, that time function is usually used in combinations with srand or maybe what you are porting uses it some other way, but you should not use those functions. I had encountered the same issue at some point
Hi, I have a dumb question... Is there anything special I should do to include an asset folder? Like fonts, images, etc. I tried to setup the project like in the particles example but when I press build, the resulting pdx does not contain the asset folder (which is named Source, placed at the same level as main.cpp). For info I am using CLion on Windows. Other non-I/O code can run btw.
Oh nvm, something somehow replaced CMAKE_CURRENT_SOURCE_DIR with an actual path (clion, is that you?), I reverted the changes and its working.
Just a side question, I am planning to use a library but it throws lots of things... I read that exception handling is on schedule, is it going well at the moment?
Hey, sorry for the delay in response w/r/t/ the question about exceptions. They're still something I want to be able to support. I've done some tinkering with little progress, so it's not clear how that's going to happen, but it is a key goal for the project to be able to support this. If anyone has any ideas I'm all ears.
I have this exact same problem, and I believe I have followed all the requirements as stated in the documentation. Using a Mac M1 Max.
This worked for me as well! Thanks!
Has anyone been able to make the json decoder work? I have implemented all the decoder methods, and I understand that it should automatically traverse all the elements in the json structure, but that's not happening.
Any insight is appreciated
I did do it in C and highly tailored it to my data and it was a PITA. Some of the functions retrun a value that stops parsing of siblings or some such - check your return values carefully
For me, didDecodeArrayValue always returns pos = 0 and the value is the whole json as a single string.
And look at the comment of the definition:
void (didDecodeArrayValue)(json_decoder decoder, int pos, json_value value); // if pos==0, this was a bare value at the root of the file
though, in the ShouldDecode methods, I'm always returning 1, but the decoder never goes there.
For instance, this is the json I'm testing. And I have tested a few others
At this point, I highly recommend against using Panic's C implementation of JSON parsing because there are some really great libs out there for json parsing in C++ which are a complete snap to use with any pdcpp project, completely performant, and offer semantics which are far more natural than any C implementation can offer.
My personal favourite is Niels Lohmann's: GitHub - nlohmann/json: JSON for Modern C++
All I have to do is add it as a submodule to my git repo and add two lines to my CMakeLists.txt:
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/submodules/json)
target_link_libraries(${PLAYDATE_GAME_NAME} PRIVATE nlohmann_json::nlohmann_json)
There are, however, a bazillion other libs out there, and between native support and the modify_target_for_playdate
function, I expect you can get pretty much any of the major libraries working without too much fuss.
Thank you for your response!! Indeed, I couldn't make playdate's json decoder to work. So I implemented jsmn solution, but I might inspect your suggestion which seems more friendly.
Hello everyone, and thanks for the amazing work! As much as I enjoy the simplicity and low-levelness of pure C, after all my experience it's quite hard to think without OOP
My question is, under which license Playdate-C++ distributed? I couldn't find a license file in the repository, nor I've seen any mentions regarding licensing.
Thank you.
@NaOH as requested by Belyavin, can you add a license file in the github repo please? MIT would be great. Thanks.
Hey all, thanks for your concern regarding the license, that was definitely a bit of an oversight. I had set up the API and extensions library as MIT, so I added the same license to the boilerplate package. I hope you soldiered on regardless, but I do apologize for the delay.