Pass const std::function<void()> as parameter in SDL_AddTimer as void*

I am trying to pass a const std::function<void()> & as void * to SDL_AddTimer, which its 3rd parameter is void *. I tried with reinterpret_cast SDL_AddTimer(interval, wrapper, reinterpret_cast<void *>(const_cast<std::function<void()> *>(fn))); But on my wrapper, it crashes uint32_t wrapper(uint32_t interval, void *param) { auto fn = static_cast<std::function<void()> *>(param); (*fn)(); // crashes here. return interval; } What… Read More Pass const std::function<void()> as parameter in SDL_AddTimer as void*

Fastest way to load a texture in C++ with SDL2

I’m currently following Lets Make Games’ tutorial series for making a game in C++ with SDL2. In the episode, he uses this method to create a texture: SDL_Renderer* renderer; SDL_Texture* tex; SDL_Surface* tmpSurface = IMG_LOAD("name") tex = SDL_CreateTextureFromSurface(renderer, tmp); SDL_FreeSurface(tmpSurface); I was a little confused about this when I saw it in the video, as… Read More Fastest way to load a texture in C++ with SDL2

game.h no such file or directory when using SDL with VScode

So, I am learning SDL 2 and using it with vscode, this is my file structure in the miain.cpp file this is my code: #include <game.h> int main(int argc, char* argv[]){ int screenWidth = 1024; int screenHight = 600; Game game("Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, screenWidth, screenHight, SDL_WINDOW_SHOWN); while(game.gameState != GameState::EXIT){ SDL_Event evnt; SDL_PollEvent(&evnt); switch (evnt.type){ case… Read More game.h no such file or directory when using SDL with VScode

I have this error System.ServiceModel.Security.MessageSecurityException

For what I read and understood, this happens when I’m not sending the authentication. But I tried to send it in two ways: string userN = "username"; string _pasw = "password"; BasicHttpBinding binding = new BasicHttpBinding(); Endpoint wsdl = new Endpoint("MyEndpoint"); SoapClient client = new SoapClient(binding, wsdl); client.ClientCredentials.UserName.UserName = userN; client.ClientCredentials.UserName.Password = _pasw; await client.OpenAsync();… Read More I have this error System.ServiceModel.Security.MessageSecurityException

Parse over large JSON array of Objects from Facebook

This is the JSON array: { "id": "", "name": "", "posts": { "data": [ { "likes": { "data": [ ], "paging": { "cursors": { "before": "QVFIUnpFd2IwMlhuOWI3dJqelFNNEZAPWDlqeENTNkg1N2RqMm9zQXBreVV6bE9KNXJzX29LeXlMZAzhNT2x3TEhlcGk3OG1Bd3ZABRmpyTXhnNDZAWV2hR", "after": "QVFIUl9Vbm14cld0dm41OTFtKYmgtelBKall2bnBINjBQMXBiNkNCMUM0d21lQXptOXRvbklkU0pHbV9yejNBVG9Jb2hqQTFoem1mdm9zMnJn" }, "next": "" }, "summary": { "total_count": 84, "can_like": true, "has_liked": false } }, "comments": { "data": [ { "created_time": "2022-05-25T18:22:19+0000", "message": "", "id": "" }, {… Read More Parse over large JSON array of Objects from Facebook