Line 90:
Line 90:
Now, open menu.cpp. Find the MainMenu function. To load an image, you declare an instance of the GuiImage class. Unless, in the main window, you will want to declare it this way:
Now, open menu.cpp. Find the MainMenu function. To load an image, you declare an instance of the GuiImage class. Unless, in the main window, you will want to declare it this way:
<source lang="cpp">
<source lang="cpp">
−
GuiImage image(''ImageData'');
+
GuiImage image(ImageData);
</source>
</source>
What is the ImageData inside the initializer function? Well before actually creating the image, you must load your image. This can be done by creating an instance of the GuiImageData class:
What is the ImageData inside the initializer function? Well before actually creating the image, you must load your image. This can be done by creating an instance of the GuiImageData class:
<source lang="cpp">
<source lang="cpp">
−
GuiImageData imagedata(''image_source'');
+
GuiImageData imagedata(image_source);
</source>
</source>
The image source is your image buffer, where the contents of the image are help. The image must be in the png format, and have dimensions that are a multiple of 4. To load an image from an sd card to an image buffer, do the following:
The image source is your image buffer, where the contents of the image are help. The image must be in the png format, and have dimensions that are a multiple of 4. To load an image from an sd card to an image buffer, do the following:
<source lang="cpp">
<source lang="cpp">
−
FILE *fp = fopen("''Path to image on sd card''","r");
+
FILE *fp = fopen("Path to image on sd card","r");
''todo''
''todo''
</source>
</source>
You may be wondering how an image gets loaded into a buffer. Whenever you want to add a new image, you must copy the image to the source/images folder, and add it to filelist.h:
You may be wondering how an image gets loaded into a buffer. Whenever you want to add a new image, you must copy the image to the source/images folder, and add it to filelist.h:
<source lang = "cpp">
<source lang = "cpp">
−
extern const u8 ''image_name_without_.png''_png[];
+
extern const u8 image_name_png[];
−
extern const u32 ''image_name_without_.png''_size;
+
extern const u32 image_name_png_size;
</source>
</source>
Then your image will be put into the ''image_name_without_.png''_png buffer when it is compiled.
Then your image will be put into the ''image_name_without_.png''_png buffer when it is compiled.
Line 112:
Line 112:
<source lang = "cpp">
<source lang = "cpp">
HaltGui();
HaltGui();
−
''GuiWindow''.Append(&''image'');
+
GuiWindow.Append(&image);
ResumeGui();
ResumeGui();
</source>
</source>