87 lines
2.6 KiB
C++
87 lines
2.6 KiB
C++
/* _______________ ,----------------------------------------------------------------.
|
|
//`````````````\\ \ \
|
|
//~~~~~~~~~~~~~~~\\ \ by @ohsqueezy & @sleepin \
|
|
//=================\\ \ [ohsqueezy.itch.io] [sleepin.itch.io] \
|
|
// \\ \ \
|
|
// \\ \ code released under the zlib license [git.nugget.fun/pudding] \
|
|
// ☆ GUNKISS ☆ \\ \ \
|
|
//_________________________\\ `---------------------------------------------------------------*/
|
|
|
|
#ifndef ITEM_H_
|
|
#define ITEM_H_
|
|
|
|
/* including so we can use GLuint type */
|
|
#if defined(__EMSCRIPTEN__)
|
|
#include <GL/glew.h>
|
|
#elif defined(__ANDROID__) || defined(ANDROID)
|
|
#include <GLES3/gl3.h>
|
|
#include <GLES3/gl3ext.h>
|
|
#else
|
|
#include "glew/glew.h"
|
|
#endif
|
|
|
|
#include <vector>
|
|
#include <sstream>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <functional>
|
|
#include <SDL.h>
|
|
#include "json/json.hpp"
|
|
#include "Texture.hpp"
|
|
#include "Log.hpp"
|
|
#include "Model.hpp"
|
|
#include "Carousel.hpp"
|
|
|
|
class Item
|
|
{
|
|
|
|
private:
|
|
|
|
nlohmann::json json = {};
|
|
sb::Plane item_view;
|
|
sb::Carousel carousel;
|
|
std::string item_brand_name = "", item_product_name = "", item_upc = "";
|
|
void text_property(const std::string&, std::string&, const std::string&);
|
|
|
|
/*
|
|
* add properties: ingredients, protein weight, nutrition grade, popularity, "serving unit", keywords,
|
|
* allergens, calories, fat, saturated fat, cholesterol, sodium, carbohydrates, fiber, sugar, potassium
|
|
*/
|
|
|
|
public:
|
|
|
|
Item();
|
|
void texture(sb::Texture&, const std::string&);
|
|
void brand_name(const std::string&);
|
|
const std::string& brand_name() const;
|
|
void product_name(const std::string&);
|
|
const std::string& product_name() const;
|
|
void upc(const std::string&);
|
|
const std::string& upc() const;
|
|
std::string full_name() const;
|
|
sb::Texture& current_texture();
|
|
void next_texture();
|
|
void previous_texture();
|
|
std::size_t texture_count();
|
|
sb::Plane& view();
|
|
bool at_first() const;
|
|
bool at_last();
|
|
void to_first();
|
|
void to_last();
|
|
|
|
};
|
|
|
|
namespace std
|
|
{
|
|
/*!
|
|
* Support passing item objects to the global stream operator.
|
|
*
|
|
* @param out The output stream
|
|
* @param item The item to be printed
|
|
* @return The submitted output stream with the text representation of item added
|
|
*/
|
|
std::ostream& operator<<(std::ostream& out, const Item& item);
|
|
}
|
|
|
|
#endif
|