Difference between revisions of "HomeMenu/Installation and usage"

From WiiBrew
Jump to navigation Jump to search
(←Created page with '==Installation and usage== ===Installation=== # Copy all the .c and .h files into your project (make sure the .c are accessible as ''source''s and .h accessible as ''include''...')
 
m (Categorized)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
==Installation and usage==
 
==Installation and usage==
===Installation===
+
=== Installation ===
 
# Copy all the .c and .h files into your project (make sure the .c are accessible as ''source''s and .h accessible as ''include''s).
 
# Copy all the .c and .h files into your project (make sure the .c are accessible as ''source''s and .h accessible as ''include''s).
 
# Add <code>#include "HomeMenu.h"</code> where appropriate.
 
# Add <code>#include "HomeMenu.h"</code> where appropriate.
 
# Add <code>-lasnd -lwiiuse</code> to your MakeFile's <code>LIBS :=</code> line.
 
# Add <code>-lasnd -lwiiuse</code> to your MakeFile's <code>LIBS :=</code> line.
  
===Usage===
+
=== Usage ===
# Call <code>HomeMenu_Init()</code> to set things up. Its parameters are:
+
# Call <code>HomeMenu_Init()</code> to set things up. Its parameters are:
 
#* <code>int screenWidth</code> -- horizontal resolution of screen.
 
#* <code>int screenWidth</code> -- horizontal resolution of screen.
 
#* <code>int screenHeight</code> -- vertical resolution of screen.
 
#* <code>int screenHeight</code> -- vertical resolution of screen.
Line 12: Line 12:
 
#* <code>void* framebuffer1</code> -- pointer to the second framebuffer (Currently assumes double-buffering).
 
#* <code>void* framebuffer1</code> -- pointer to the second framebuffer (Currently assumes double-buffering).
 
#* <code>u8 framebufferIndex</code> -- index to last buffer drawn to [0, 1].
 
#* <code>u8 framebufferIndex</code> -- index to last buffer drawn to [0, 1].
# Specify graphics library with <code>HomeMenu_SetGFX()</code>. Accepted values are:
+
# Specify graphics library with <code>HomeMenu_SetGFX()</code>. Accepted values are:
 
#* <code>HM_GFX_GRRLIB</code>
 
#* <code>HM_GFX_GRRLIB</code>
 
#* <code>HM_GFX_LIBWIISPRITE</code>
 
#* <code>HM_GFX_LIBWIISPRITE</code>
 
#* <code>HM_GFX_FAILSAFE</code> (which currently draws nothing).
 
#* <code>HM_GFX_FAILSAFE</code> (which currently draws nothing).
# Specify sound library with <code>HomeMenu_SetSND()</code>. Accepted values are:
+
# Specify sound library with <code>HomeMenu_SetSND()</code>. Accepted values are:
 
#* <code>HM_SND_ASND</code>
 
#* <code>HM_SND_ASND</code>
 
#* <code>HM_SND_SDL</code> (not yet implemented)
 
#* <code>HM_SND_SDL</code> (not yet implemented)
 
#* <code>HM_SND_NOSOUND</code>.
 
#* <code>HM_SND_NOSOUND</code>.
# When you want to display the menu (when the user presses HOME), simply call <code>HomeMenu_Show()</code>. In order for [[HomeMenu]] to be able to take a screenshot (used as the menu background) <code>HomeMenu_Show()</code> must be called ''before'' flushing the framebuffer.
+
# When you want to display the menu (when the user presses HOME), simply call <code>HomeMenu_Show()</code>. In order for [[HomeMenu]] to be able to take a screenshot (used as the menu background) <code>HomeMenu_Show()</code> must be called ''before'' flushing the framebuffer.
  
'''Tip:''' If you have a callback set up for when the user holds down on the wiimote's powerbutton, add <code>HomeMenu_Hide()</code> to this callback to tell HomeMenu to relinquish its control of the main thread.
+
'''Tip:''' If you have a callback set up for when the user holds down on the wiimote's powerbutton, add <code>HomeMenu_Hide()</code> to this callback to tell HomeMenu to relinquish its control of the main thread.
  
'''Tip:''' If your application relies on a timer, consider using the <code>HomeMenu_SetAfterHideMenu(yourCallback)</code> callback setter. This will allow you to update your timer (if necessary) before resuming your application.
+
'''Tip:''' If your application relies on a timer, consider using the <code>HomeMenu_SetAfterHideMenu(yourCallback)</code> callback setter. This will allow you to update your timer (if necessary) before resuming your application.
  
====Libwiisprite users====
+
==== Libwiisprite users ====
Currently, the pointers to the framebuffers and the framebuffer index are stored in the <code>GameWindow</code> object as <code>private</code> members. [[Shiny Red Tank]] got around this problem by adding accessors to the <code>GameWindow</code> class. Hopefully, if there is enough demand, the accessors will be included in the next version of LWS (go ask!). Here are my modifications:
+
Currently, the pointers to the framebuffers and the framebuffer index are stored in the <code>GameWindow</code> object as <code>private</code> members. [[Shiny Red Tank]] got around this problem by adding accessors to the <code>GameWindow</code> class. Hopefully, if there is enough demand, the accessors will be included in the next version of LWS (go ask!). Here are my modifications:
  
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
{| class="wikitable collapsible collapsed" width="61.8%"
Line 65: Line 65:
 
|}
 
|}
  
====GRRLIB 4.0.0 users====
+
==== GRRLIB 4.0.0 users ====
I think the same problem (as mentioned above) applies to you guys. Here are the accessors I used during my testing.
+
I think the same problem (as mentioned above) applies to you guys. Here are the accessors I used during my testing.
  
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
{| class="wikitable collapsible collapsed" width="61.8%"
Line 98: Line 98:
 
</source>
 
</source>
 
|}
 
|}
 +
 +
[[Category:How To]]

Latest revision as of 21:58, 10 April 2021

Installation and usage

Installation

  1. Copy all the .c and .h files into your project (make sure the .c are accessible as sources and .h accessible as includes).
  2. Add #include "HomeMenu.h" where appropriate.
  3. Add -lasnd -lwiiuse to your MakeFile's LIBS := line.

Usage

  1. Call HomeMenu_Init() to set things up. Its parameters are:
    • int screenWidth -- horizontal resolution of screen.
    • int screenHeight -- vertical resolution of screen.
    • void* framebuffer0 -- pointer to the first framebuffer.
    • void* framebuffer1 -- pointer to the second framebuffer (Currently assumes double-buffering).
    • u8 framebufferIndex -- index to last buffer drawn to [0, 1].
  2. Specify graphics library with HomeMenu_SetGFX(). Accepted values are:
    • HM_GFX_GRRLIB
    • HM_GFX_LIBWIISPRITE
    • HM_GFX_FAILSAFE (which currently draws nothing).
  3. Specify sound library with HomeMenu_SetSND(). Accepted values are:
    • HM_SND_ASND
    • HM_SND_SDL (not yet implemented)
    • HM_SND_NOSOUND.
  4. When you want to display the menu (when the user presses HOME), simply call HomeMenu_Show(). In order for HomeMenu to be able to take a screenshot (used as the menu background) HomeMenu_Show() must be called before flushing the framebuffer.

Tip: If you have a callback set up for when the user holds down on the wiimote's powerbutton, add HomeMenu_Hide() to this callback to tell HomeMenu to relinquish its control of the main thread.

Tip: If your application relies on a timer, consider using the HomeMenu_SetAfterHideMenu(yourCallback) callback setter. This will allow you to update your timer (if necessary) before resuming your application.

Libwiisprite users

Currently, the pointers to the framebuffers and the framebuffer index are stored in the GameWindow object as private members. Shiny Red Tank got around this problem by adding accessors to the GameWindow class. Hopefully, if there is enough demand, the accessors will be included in the next version of LWS (go ask!). Here are my modifications:

GRRLIB 4.0.0 users

I think the same problem (as mentioned above) applies to you guys. Here are the accessors I used during my testing.