mirror of https://github.com/libAthena/athena.git
Add example program (Currently only targets wii)keep-around/8124d219d9509ee23a35d550d9821582b1b3015e
parent
8e8135370e
commit
1ee7c82d8b
@ -0,0 +1,13 @@ |
||||
cmake_minimum_required(VERSION 3.0) |
||||
project(Example) |
||||
|
||||
include_directories(${ATHENA_INCLUDE_DIR}) |
||||
add_executable(Example |
||||
main.cpp) |
||||
|
||||
if(GEKKO) |
||||
target_link_libraries(Example AthenaCore z wiiuse bte ogc m) |
||||
else() |
||||
#TODO: add normal link libraries |
||||
endif() |
||||
|
@ -0,0 +1,58 @@ |
||||
#include <iostream> |
||||
#if GEKKO |
||||
#include <gccore.h> |
||||
#if HW_RVL |
||||
#include <wiiuse/wpad.h> |
||||
#endif |
||||
|
||||
static void *xfb = nullptr; |
||||
static GXRModeObj* rmode = nullptr; |
||||
|
||||
#endif |
||||
|
||||
#include <Athena/MemoryReader.hpp> |
||||
|
||||
int main() |
||||
{ |
||||
#if GEKKO |
||||
VIDEO_Init(); |
||||
#if HW_RVL |
||||
WPAD_Init(); |
||||
#endif |
||||
PAD_Init(); |
||||
|
||||
rmode = VIDEO_GetPreferredMode(nullptr); |
||||
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); |
||||
|
||||
CON_Init(xfb, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ); |
||||
CON_EnableGecko(CARD_SLOTB, true); |
||||
|
||||
VIDEO_Configure(rmode); |
||||
VIDEO_SetBlack(false); |
||||
|
||||
VIDEO_Flush(); |
||||
|
||||
VIDEO_WaitVSync(); |
||||
if (rmode->viTVMode & VI_NON_INTERLACE) |
||||
VIDEO_WaitVSync(); |
||||
|
||||
Athena::io::MemoryCopyReader test("sd:/test.dat"); |
||||
while(true) |
||||
{ |
||||
#if HW_RVL |
||||
WPAD_ScanPads(); |
||||
#endif |
||||
PAD_ScanPads(); |
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_START) |
||||
break; |
||||
|
||||
#if HW_RVL |
||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) |
||||
break; |
||||
#endif |
||||
VIDEO_WaitVSync(); |
||||
} |
||||
#endif |
||||
return 0; |
||||
} |
||||
|
Loading…
Reference in new issue