#ifndef Pudding_h_ #define Pudding_h_ #include #include #include #include #include "json/json.hpp" #include "glm/vec2.hpp" #include "Game.hpp" #include "Sprite.hpp" #include "Color.hpp" #include "extension.hpp" struct Pudding : Game { const std::string USER_AGENT = "Work in progress game for http://shampoo.ooo"; const std::string OPEN_FOOD_API_URL = "https://world.openfoodfacts.org/api/v0/product/"; const std::string NUTRONIX_API_URL = "https://trackapi.nutritionix.com/v2/search/item?upc="; const std::string NUTRONIX_APP_ID = "ea0f2e7e"; const std::string NUTRONIX_APP_KEY = "39218dde526dd3349daa028deda518ae"; const std::string BARCODE_MONSTER_API_URL = "https://barcode.monster/api/"; const std::string EDAMAM_API_URL = "https://api.edamam.com/api/food-database/v2/parser?upc=&app_id=&app_key="; const std::string EDAMAM_APP_ID = "c23b139f"; const std::string EDAMAM_APP_KEY = "c54cf8c997534caf7ee92b1ccc7d95a3"; const std::string BEST_BUY_API_URL = "https://api.bestbuy.com/v1/products(upc=)?format=json&apiKey="; const std::string BEST_BUY_API_KEY = "cFshpD7C2LtMq07GqlBVpYtY"; /* * images, ingredients, protein weight, nutrition grade, popularity, "serving unit", item name, brand name, keywords, * allergens, calories, fat, saturated fat, cholesterol, sodium, carbohydrates, fiber, sugar, potassium */ typedef Game super; Sprite image = Sprite(this); std::string current_barcode; Pudding(); void load_sdl_context(); nlohmann::json food_json_from_barcode(std::string); void curl_get_bytes(std::string url, std::vector*, std::string = ""); static size_t store_curl_response(std::uint8_t*, size_t, size_t, std::vector*); bool is_food_json_empty(nlohmann::json); SDL_Texture* texture_from_image_url(std::string); void refresh(); void update(); std::string get_class_name() { return "Pudding"; } }; #endif