Skip to content

Commit e996fe2

Browse files
committedFeb 11, 2019
ADDED: GetClipboardText(), SetClipboardText()
1 parent 6dbec47 commit e996fe2

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed
 

‎src/core.c

+17
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,23 @@ const char *GetMonitorName(int monitor)
984984
return "";
985985
}
986986

987+
// Get clipboard text content
988+
// NOTE: returned string is allocated and freed by GLFW
989+
const char *GetClipboardText(void)
990+
{
991+
#if defined(PLATFORM_DESKTOP)
992+
return glfwGetClipboardString(window);
993+
#endif
994+
}
995+
996+
// Set clipboard text content
997+
void SetClipboardText(const char *text)
998+
{
999+
#if defined(PLATFORM_DESKTOP)
1000+
glfwSetClipboardString(window, text);
1001+
#endif
1002+
}
1003+
9871004
// Show mouse cursor
9881005
void ShowCursor(void)
9891006
{

‎src/raylib.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,8 @@ RLAPI int GetMonitorHeight(int monitor); // Get primary
884884
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
885885
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
886886
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
887+
RLAPI const char *GetClipboardText(void); // Get clipboard text content
888+
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
887889

888890
// Cursor-related functions
889891
RLAPI void ShowCursor(void); // Shows cursor
@@ -1176,8 +1178,7 @@ RLAPI const char *TextSubtext(const char *text, int position, int length);
11761178
RLAPI const char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory should be freed!)
11771179
RLAPI const char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (memory should be freed!)
11781180
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
1179-
RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings (memory should be freed!)
1180-
RLAPI void TextSplitEx(const char *text, char delimiter, int *count, const char **ptrs, int *lengths); // Get pointers to substrings separated by delimiter
1181+
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
11811182
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
11821183
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
11831184
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string

‎src/textures.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ void ExportImageAsCode(Image image, const char *fileName)
871871

872872
// Get file name from path and convert variable name to uppercase
873873
strcpy(varFileName, GetFileNameWithoutExt(fileName));
874-
for (int i = 0; varFileName[i] != '\0'; i++) if (varFileName[i] >= 'a' && varFileName[i] <= 'z') { varFileName[i] = varFileName[i] - 32; }
874+
for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; }
875875

876876
// Add image information
877877
fprintf(txtFile, "// Image data information\n");

0 commit comments

Comments
 (0)
Please sign in to comment.