Line 47: |
Line 47: |
| | | |
| ====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!). | + | 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 ***/ |
| + | |
| + | //!Gets a pointer to a framebuffer. |
| + | //!\return a pointer to desired framebuffer, or NULL if index is out of bounds. |
| + | void* GetFrameBuffer(u32 index); |
| + | //!Gets index of active 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> |
| + | |} |
| | | |
| ==Feedback== | | ==Feedback== |