2021-07-12 21:42:52 +01:00
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdlib>
|
2021-08-15 11:58:10 +01:00
|
|
|
#include <string>
|
2021-07-12 21:42:52 +01:00
|
|
|
|
|
|
|
#include <gccore.h>
|
|
|
|
#include <wiiuse/wpad.h>
|
|
|
|
|
2021-08-15 12:08:30 +01:00
|
|
|
#include "networking.h"
|
2021-07-12 21:42:52 +01:00
|
|
|
#include "screen.h"
|
2021-08-15 12:08:30 +01:00
|
|
|
#include "udp_client.h"
|
2021-07-12 21:42:52 +01:00
|
|
|
|
2021-08-15 11:58:10 +01:00
|
|
|
/// The IP address of the server to connect to.
|
|
|
|
const std::string SERVER_IP_ADDRESS = "192.168.0.1";
|
|
|
|
|
|
|
|
/// The port number of the server to connect to.
|
|
|
|
constexpr uint16_t SERVER_PORT = 10000;
|
|
|
|
|
2021-07-12 21:42:52 +01:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2021-08-15 11:58:10 +01:00
|
|
|
// Screen init
|
2021-07-12 21:42:52 +01:00
|
|
|
auto screen = Screen{};
|
|
|
|
|
2021-08-15 11:58:10 +01:00
|
|
|
// Controller init
|
2021-07-12 21:42:52 +01:00
|
|
|
WPAD_Init();
|
|
|
|
|
2021-08-15 11:58:10 +01:00
|
|
|
// Network init
|
|
|
|
Networking network;
|
|
|
|
network.init();
|
|
|
|
auto udp_client = UdpClient{ SERVER_IP_ADDRESS, SERVER_PORT };
|
2021-07-12 21:42:52 +01:00
|
|
|
|
|
|
|
auto exit = false;
|
|
|
|
while (!exit)
|
|
|
|
{
|
|
|
|
// Call WPAD_ScanPads each loop, this reads the latest controller states
|
|
|
|
WPAD_ScanPads();
|
|
|
|
const auto pressed = WPAD_ButtonsDown(0);
|
|
|
|
if (pressed & WPAD_BUTTON_HOME)
|
|
|
|
exit = true;
|
|
|
|
|
|
|
|
// Clear the frame buffer.
|
|
|
|
screen.clear();
|
|
|
|
|
|
|
|
// drawing goes here
|
|
|
|
|
|
|
|
// Wait for the next frame
|
|
|
|
screen.wait_for_vsync();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|