|
@@ -2,7 +2,7 @@
|
|
|
//
|
|
|
// Conversion from the Monkey2 version that I wrote.
|
|
|
//
|
|
|
-// Todo : the map editor, copy to clipboard, ovals!, testing.
|
|
|
+// Todo : the map editor, ovals!, testing.
|
|
|
|
|
|
#include "raylib.h"
|
|
|
#include <math.h>
|
|
@@ -2039,7 +2039,8 @@ void previewselection(bool drawit){
|
|
|
}
|
|
|
|
|
|
void copytoclipboard(){
|
|
|
-/*
|
|
|
+/*
|
|
|
+ //This is the original code from the monkey2 language..
|
|
|
Local out:String="int sprite["+spriteheight+"]["+spritewidth+"] = {"+String.FromChar(10)
|
|
|
For Local y:Int=spriteheight-1 to 0 Step -1
|
|
|
Local a:String
|
|
@@ -2054,6 +2055,40 @@ void copytoclipboard(){
|
|
|
out+="};"
|
|
|
instance.ClipboardText = out
|
|
|
*/
|
|
|
+ // Here we create a copy and paste ready
|
|
|
+ // text that can be pasted into a code editor.
|
|
|
+ // It shows how to convert a array into c language code.
|
|
|
+ char output1[1000] = "int sprite[";
|
|
|
+ char output2[32];
|
|
|
+ sprintf(output2, "%d", spritewidth);
|
|
|
+ strcat(output1,output2);
|
|
|
+ strcat(output1,"][");
|
|
|
+ sprintf(output2, "%d", spriteheight);
|
|
|
+ strcat(output1,output2);
|
|
|
+ strcat(output1,"] = {\n");
|
|
|
+
|
|
|
+ int x=0;int y=0;
|
|
|
+ for (y=0;y<spriteheight;y++){
|
|
|
+
|
|
|
+ for(x=0;x<spritewidth-1;x++){
|
|
|
+ if(x==0)strcat(output1,"{");
|
|
|
+ char num[16];
|
|
|
+ sprintf(num, "%d", map[y][x]);
|
|
|
+ strcat(output1,num);
|
|
|
+ strcat(output1,",");
|
|
|
+ }
|
|
|
+ char num2[16];
|
|
|
+ sprintf(num2, "%d", map[y][spritewidth-1]);
|
|
|
+ strcat(output1,num2);
|
|
|
+ if(y<spriteheight-1){
|
|
|
+ strcat(output1,"},\n");
|
|
|
+ }else{
|
|
|
+ strcat(output1,"}};\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SetClipboardText(output1);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|