oxy_files.h
"oxy_files.h" is oxygen virtual file system.
Code:
/**
* @brief file dynamic pointer.
*/
struct oxy_files_t {
uint8_t user_id;
char name[9];
uint8_t type;
gfx_sprite_t *icon;
char *description;
bool archived;
bool locked;
int location;
int size;
bool indexed;
bool pinned;
};
extern struct oxy_files_t *oxy_file;
/**
* @brief Folder dynamic pointer.
*/
struct oxy_folders_t {
uint8_t user_id;
char name[9];
gfx_sprite_t *icon;
bool locked;
int location;
};
extern struct oxy_folders_t *oxy_folders;
/**
* @brief File system inforomation.
*/
struct oxy_filesysteminfo_t {
int version;
int numfiles;
int numfolders;
int numtempfiles;
};
extern struct oxy_filesysteminfo_t oxy_filesysteminfo;
// Functions
/**
* @brief Detects all files on calulator (programs and appvars).
*/
void oxy_DetectAllFiles(void); // including functions
/** Removes folder from index in pointer.
* @param index
*/
void oxy_DeleteFolder(int index);
/** Removes file from index in pointer.
* @param index
*/
void oxy_DeleteFile(int index);
/**
* @brief Adds a File to a location 1.
*/
void oxy_AddFile(void);
/** Adds folder to location.
* @param name Name of the
* @param location Int of wanted folder location.
*/
void oxy_AddFolder(char name[9], int location);
/**
* @brief Sorts all folders.
*/
void oxy_SortFolders(void);
int oxy_CompareFolderNames(void *a, void *b);
/**
* @brief Sorts Files.
*/
void oxy_SortFiles(void);
int oxy_CompareFileNames(void *a, void *b);
/**
* Gets the amount file type from oxygens files type.
* @param type oxygen file type uint8_t.
* @returns Returns TI file type.
*/
uint8_t oxy_GetFileType(uint8_t type);
/**
* @brief Gets Asm Icon and stores into file pointer.
*/
void oxy_GetAsmIcons(void);
/**
* @brief Gets Basic Icon and stores into file pointer.
*/
void oxy_GetBasicIcons(void);
/**
* @brief Save all variables to oxygen main appvar.
*/
void oxy_SaveFilesystem(void);
/**
* @brief Loads all file variables from oxygen main appvar.
* @returns Returns false if there is no files are found,
* and true otherwise.
*/
bool oxy_LoadFilesystem(void);
oxy_gfx.h
"oxy_gfx.h" is Filled with graphical shapes and sprite routines.
Code:
// Filled with graphical shapes and sprite functions.
struct oxy_data_t {
/*gradient functions*/
uint8_t start_color, end_color;
uint8_t transparent_color;
};
extern struct oxy_data_t oxy_data;
/**
* Filled Rectangle, Rounded on all sides.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundFillRectangle(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* Filled Rectangle, Rounded on top.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundFillRectangle_Upper(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* Filled Rectangle, Rounded on bottom.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundFillRectangle_Bottom(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* Filled Rectangle, Rounded on left side.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundFillRectangle_Left(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* Filled Rectangle, Rounded on right side.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundFillRectangle_Right(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* No-Fill Rectangle, Rounded on all sides.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundRectangle(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* No-Fill Rectangle, Rounded on top.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundRectangle_Upper(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* No-Fill Rectangle, Rounded on bottom.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundRectangle_Bottom(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* No-Fill Rectangle, Rounded on Left side.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundRectangle_Left(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
/**
* No-Fill Rectangle, Rounded on Right side.
* @param x X Position
* @param y Y Position
* @param w Width of Rectangle
* @param h Height of Rectangle
*/
void oxy_RoundRectangle_Right(uint16_t x, uint8_t y, uint24_t w, uint8_t h);
// Sprite Routines
/**
* Replaces all colors in sprite with new colors.
* @param in Sprite containing color.
* @param old_color Old color,color you want to change.
* @param new_color Color you want to replace old color.
*/
void oxy_ReplaceSpriteColor(uint8_t *data, const uint8_t old_color, const uint8_t new_color, int size);
/**
* Apply a mask over a sprite.
* @param in_sprite Sprite you want to apply mask over.
* @param mask_sprite Mask sprite that will be applied over "in_sprite". <br>
* if "mask_sprite" and "in_sprite" don't have the same width and height.
*/
void oxy_ApplyMaskToSprite(gfx_sprite_t *in_sprite, gfx_sprite_t *mask_sprite);
/**
* Apply a new palette onto a sprite.
* @param in_sprite Sprite you want to apply palette onto.
* @param map List of palette map.
*/
void oxy_RepalettizeSprite(gfx_sprite_t *in_sprite, const uint8_t *map);
/**
* Take a sprite and produces a shadow sprite.
* @param in_sprite Sprite you want to generate a shadow from.
* @param shadow_color A palette color (ranges from 0 - 255).
*/
void oxy_GetSpriteShadow(gfx_sprite_t *out, gfx_sprite_t *in, uint8_t shadow_color);
/**
* Take in_sprite and returns list of colors .
* @param in Sprite you want to generate a shadow from.
*@returns Returns a pointer to list of colors
*/
uint8_t* oxy_GetSpritePaletteMap(gfx_sprite_t *in);
/**
* Takes in_sprite and prints out a full screen version.
* @param in Sprite you want to Enlarge and Fill Screen.
*/
void oxy_EnlargeIt(gfx_sprite_t *in);
/**
* Takes in_sprite and prints out a full screen version.
* Smart Enlarge attempts to enlarge and increase image quality.
* @param in Sprite you want to enlarge and Fill Screen.
*/
void oxy SmartEnlargeIt(gfx_sprite_t *in);
// Settings Routines
/** Takes "in_sprite"
* Returns Transparent Palette color.
* @return Returns Transparent Palette color.
*/
uint8_t oxy_ReturnTransparentColor(void);
/**
* Set gradients color.
* @param start_color .
* @param end_color .
*/
void oxy_SetGradientColor(uint8_t start_color, uint8_t end_color);
/**
* Sets the transparent color for oxygen.
* @param color Set color from palette (Range: 0 - 255).
*/
void oxy_SetTransparentColor(uint8_t color);
// Experimental Routines
/**
* Draws a Transparent GIF/Animation.
* @param frames
* @param frame_change_time
* @param frame_amount
* @param x
* @param y
*/
void oxy_TransparentGIF(gfx_sprite_t *frames, uint8_t frame_change_time, uint8_t frame_amount, uint16_t x, uint8_t y);
/**
* Draws a Non-Transparent GIF/Animation.
* @param frames
* @param frame_change_time
* @param frame_amount
* @param x
* @param y
*/
void oxy_GIF(gfx_sprite_t *frames, uint8_t frame_change_time, uint8_t frame_amount, uint16_t x, uint8_t y);
oxy_gui.h
"oxy_gui.h" is filled need things for a gui. (does not include windows or buttons as if now)
Code:
/**
* @brief Used in string input.
*
*/
struct oxy_stringinput_t {
int charsamount;
char *text;
uint8_t type;
};
extern struct oxy_stringinput_t oxy_stringinput;
// String, Num Input.
/**
* Sets current project version.
* @param title Input text (text displayed before input).
* @param x X coordinate
* @param y Y coordinate
* @param maxchar Max input characters
* @returns char Return users input
*/
char oxy_StringInput(const char title[], uint16_t x, uint8_t y, int maxchar);
/**
* @brief Used in "oxy_StringInput" to update text
*/
void oxy_UpdateString(void);
/**
* @brief Clears any entry in "oxy_stringinput".
*/
void oxy_ResetStringInput(void);
/**
* @brief Graphical key board that allows for special char input.
*/
uint8_t oxy_InsertSpecialCharacter(void);
/**
* Draws a color picker (and get users input).
* @param cur_select Preslected color (values range from 0-255)
* @param x X coordinate
* @param y Y coordinate
*/
uint8_t oxy_ColorPicker(uint8_t cur_select, uint16_t x, uint8_t y);
/**
* Prints Xenon Battery Icon at current battery status
* @param x X coordinate
* @param y Y coordinate
*/
void oxy_PrintBatteryStatus(uint16_t x, uint8_t y);
/**
* Prints Current Time
* @param x X coordinate
* @param y Y coordinate
*/
void oxy_PrintTime(uint16_t x, uint8_t y);
/**
* Prints Current Date
* @param x X coordinate
* @param y Y coordinate
*/
void oxy_PrintDate(uint16_t x, uint8_t y);
// Windows and buttons go here!f
oxy_mouse.h
"oxy_mouse.h" is a graphical mouse libarary.
Code:
// Variables
/**
* @brief Holds information about mouse and hoverspots.
*/
struct mouse_t{
uint16_t x;
uint8_t y;
uint8_t speed;
uint16_t scroll_X;
uint8_t scroll_Y;
uint8_t hover_amount;
int clicked_index;
gfx_sprite_t *back_buffer;
};
extern struct mouse_t mouse;
/**
* @brief Holds information about hoverspot (dynamic pointer).
*/
struct detect_t{
// bool active;
uint16_t x;
uint8_t y;
uint16_t w;
uint8_t h;
uint8_t type;
char *description;
};
extern struct detect_t *mouse_detect;
// Functions
/**
* @brief Init all variable needed for Mouse file.
*/
void oxy_InitMouse(void);
/**
* Creates a Hover spot.
* @param x X position of hoverspot.
* @param y Y position of hoverspot.
* @param w Width of hoverspot.
* @param h Height of hoverspot.
* @returns Returns the index of the hover spot.
*/
uint8_t oxy_AddHover(uint16_t x, uint8_t y, uint16_t w, uint8_t h);
/**
* Removes Hover at set index
* @param index Set this to hover spot index. (returned when hoverspot was added)
* @returns true if index was deleted and false for error.
*/
bool oxy_RemoveHover(uint8_t index);
/**
* @brief Removes all hover spots
*/
void oxy_RemoveAllHover(void);
/**
* Creates a description at index, if mouse detects hover spot with description.
* The description is placed over the mouse pointer.
* @param text Hover Spot Description .
* @param index Set this to hover spot index. (returned when hoverspot was added)
*/
bool oxy_SetHoverDescription(char text[], uint8_t index);
/**
* @brief Detects if mouse is over a hover spot
*/
uint8_t oxy_DetectHover(void);
/**
* @brief Renders Mouse to Blit(1).
*/
void oxy_RenderMouse(void);
#endif
oxy_notify.h
"oxy_notify.h" is a notification library that allows notification can be displayed in xenon and in programs.
Code:
/**
* @brief Notifications sturct file.
*/
struct oxy_notify_t{
char *title;
char *text;
uint8_t time[3];
uint8_t *date[2];
};
extern struct oxy_notify_t *oxy_notify;
/**
* @brief Nofifcation stack system (manages amount of notifications).
*/
struct oxy_notify_system_t{
uint8_t stack_amount;
};
extern struct oxy_notify_system_t oxy_notify_system;
/**
* Creates a new notification.
* @param title Title of the noification (Name of Program).
* @param text Text or dilog of the notifications.
* @param time Use oxy_GetNotifyTime();
* @param date Use oxy_GetNotifyDate();
*/
void oxy_NewNotify(const char *title, const char *text, const uint8_t *time, const uint8_t *date);
/**
* Converts Given time into a pointer for oxy_NewNotify();
* @param hour 24 hour clock.
* @param min 60 mins on clock.
* @return Pointer with given time
*/
uint8_t* oxy_GetNotifyTime(uint8_t hour, uint8_t min);
/**
* Converts Given date into a pointer for oxy_NewNotify();
* @param month month clock (ranges from 1 - 12).
* @param day Day of the months (ranges from 1 - 31).
* @return Pointer with given date
*/
uint8_t* oxy_GetNotifyDate(uint8_t month, uint8_t day);
/**
* Deletes Notification out of a stack,
* @param index Pos or index of Notification.
*/
void oxy_DeleteNotify(uint8_t index);
/**
* @brief Deletes all notification.
*/
void oxy_DeleteAllNotify(void);
/**
* @brief Detects if there are any active notifications and when to alert the user.
*/
int oxy_CheckNotify(void);
// void oxy_AlertNotify(int index);
/**
* @brief Load notification variables form oxygen main appvar.
*/
void oxy_LoadNotifySystem(void);
oxy_save.h
"oxy_save.h" Simple sections of library that saves all data into one appvar.
Code:
/**
* @brief Save all variables to oxygen main appvar.
*/
void oxy_SaveAll(void);
oxy_users.h
"oxy_users.h" is manages all user data and passwords.
Code:
/**
* @brief Users Dynamic Pointer (Stores simple user infomation).
*/
struct oxy_user_t {
uint8_t userid;
char *name;
char *password;
uint8_t type;
// maybe pins
};
extern struct oxy_user_t *oxy_user;
/**
* @brief User System Struct (stores amount of users)
*/
struct oxy_UserSystem_t {
int user_amount;
};
extern struct oxy_UserSystem_t oxy_UserSystem;
/**
* Creates a new user.
* @param name Users name.
* @param password password for locking features.
* @param type Type of user (0 = admin, 1 = user, 2 = guest).
* @returns Users index.
*/
uint8_t oxy_NewUser(const char *name, const char *password, const uint8_t type);
/**
* Sets Password of a user.
* @param password New password.
* @param index Set this to the users index.
*/
void oxy_SetUserPassword(const char *password, const int index);
/**
* Changes name of a user.
* @param name New name.
* @param index Set this to the users index.
*/
void oxy_SetUserName(const char *name, const int index);
/**
* Returns User ID user for folders and etc.
* @param index Set this to the users index.
* @returns User ID user for folders and etc.
*/
uint8_t oxy_GetUserID(const int index);
/**
* Deletes current user at set index.
* @param index Set this to the users index.
*/
void oxy_DeleteUser(const int index);
/**
* @brief Load users variables form oxygen main appvar.
*/
void oxy_LoadUsers(void);