Difference between revisions of "HomeMenu"

From WiiBrew
Jump to navigation Jump to search
Line 34: Line 34:
  
 
==Installation and usage==
 
==Installation and usage==
===Installation===
+
See [[/Installation and usage]].
# 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>-lasnd -lwiiuse</code> to your MakeFile's <code>LIBS :=</code> line.
 
 
 
===Usage===
 
# Call <code>HomeMenu_Init()</code> to set things up.  Its parameters are:
 
#* <code>int screenWidth</code> -- horizontal resolution of screen.
 
#* <code>int screenHeight</code> -- vertical resolution of screen.
 
#* <code>void* framebuffer0</code> -- pointer to the first framebuffer.
 
#* <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].
 
# Specify graphics library with <code>HomeMenu_SetGFX()</code>.  Accepted values are:
 
#* <code>HM_GFX_GRRLIB</code>
 
#* <code>HM_GFX_LIBWIISPRITE</code>
 
#* <code>HM_GFX_FAILSAFE</code> (which currently draws nothing).
 
# Specify sound library with <code>HomeMenu_SetSND()</code>.  Accepted values are:
 
#* <code>HM_SND_ASND</code>
 
#* <code>HM_SND_SDL</code> (not yet implemented)
 
#* <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.
 
 
 
'''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.
 
 
 
====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:
 
 
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
|-
 
! Changes to GameWindow.h
 
|-
 
|<source lang=cpp>
 
/*** Add the following lines in the public section ***/
 
 
 
//!Get a pointer to one of the framebuffers
 
//!\return a pointer to desired framebuffer, or NULL if index is out of bounds.
 
void* GetFrameBuffer(u32 index);
 
//!Gets the index of the current framebuffer.
 
//!\return value of index of current framebuffer.
 
u32 GetFrameBufferIndex();
 
</source>
 
|}
 
 
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
|-
 
! Changes to GameWindow.cpp
 
|-
 
|<source lang=cpp>
 
/*** Add the following lines within the namespace wsp block ***/
 
 
 
void* GameWindow::GetFrameBuffer(u32 index) {
 
if (index > 1 || index < 0)
 
return NULL;
 
else
 
return _frameBuffer[index];
 
}
 
 
 
u32 GameWindow::GetFrameBufferIndex() {
 
return _fb;
 
}
 
</source>
 
|}
 
 
 
====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.
 
 
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
|-
 
! Changes to GRRLIB.h
 
|-
 
|<source lang=c>
 
void* GetFrameBuffer(u32 index);
 
int GetFrameBufferIndex();
 
</source>
 
|}
 
 
 
{| class="wikitable collapsible collapsed" width="61.8%"
 
|-
 
! Changes to GRRLIB.c
 
|-
 
|<source lang=c>
 
/**
 
* Get a pointer to one of the framebuffers.
 
* @param index specifies which framebuffer to retrieve.
 
*/
 
void* GetFrameBuffer(u32 index) {
 
return xfb[index];
 
}
 
/**
 
* Get the index of the current framebuffer.
 
*/
 
int GetFrameBufferIndex() {
 
return fb;
 
}
 
</source>
 
|}
 
  
 
==Statistics==
 
==Statistics==

Revision as of 18:19, 11 April 2009

Template:Infobox homebrewapp

HomeMenu is a library written in C which provides a Big-N style Home Menu. It aims to be graphics-library-independent so it can be used regardless of your application's underlying graphics code/library. It also allows you to associate your own functions to events such as when the menu opens, closes, redraws.

It's coming along well but isn't completed yet. An up-to-date "To Do" list can be found on the SVN.

News

11 April 2009 -- I just tested HomeMenu with a fresh extraction of the libwiisprite tarball... it wasn't pretty. I hadn't noticed just how drastic my modifications to lws were. I'll be updating HomeMenu to work with lws out of the box in a week or so. I'll also implement some more GX related tweaking options so hand rolled graphics solutions can better control HomeMenu's behavior.

Back to coding in a week,

MetaFight 06:20, 11 April 2009 (UTC)


4 April 2009 -- I'm looking for testers. I've gotten reports of odd behavior on PAL systems, so first and foremost I'm looking for PAL testers. I also need widescreen testers (both PAL and NTSC). If you're interested please leave your contact info on the discussion page. I'll also put together a version of the menu that will allow you to take screenshots.

Thanks,

MetaFight 19:01, 4 April 2009 (UTC)


(For older news please refer to the archives.)

Installation and usage

See /Installation and usage.

Statistics

I'd like to have a general idea of how many apps use this library (once released, or even off the svn). If you use it, could you please add [[Category:Homebrew using HomeMenu]] to your application's wiki page? Thanks.

Release log

30 March 2009

  • Sourcecode released (Google Code SVN).
  • Updated preview (Now with rumble and some sound).

22 March 2009, preview

  • Not yet complete, but you can get the idea.

Thanks

See Also