Character inputs and filesystem stuff
This commit is contained in:
parent
c083aed903
commit
3767a324a7
|
|
@ -79,6 +79,7 @@ void App::SetWindow(Windows::UI::Core::CoreWindow^ window)
|
|||
// Hook keyboard events.
|
||||
window->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyDown);
|
||||
window->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &App::OnKeyUp);
|
||||
window->CharacterReceived += ref new Windows::Foundation::TypedEventHandler<Windows::UI::Core::CoreWindow^, Windows::UI::Core::CharacterReceivedEventArgs^>(this, &raylibUWP::App::OnCharacterReceived);
|
||||
|
||||
// The CoreWindow has been created, we can pass this to raylib for EGL context creation when it's time
|
||||
UWPSetCoreWindowPtr((void*)window);
|
||||
|
|
@ -448,6 +449,11 @@ void App::OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyE
|
|||
args->Handled = true;
|
||||
}
|
||||
|
||||
void App::OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args)
|
||||
{
|
||||
UWPKeyCharEvent(args->KeyCode);
|
||||
}
|
||||
|
||||
// AppSource implementation
|
||||
Windows::ApplicationModel::Core::IFrameworkView ^AppSource::CreateView()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace raylibUWP
|
|||
void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
|
||||
void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
|
||||
void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
|
||||
void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
|
||||
};
|
||||
|
||||
ref class AppSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
|
||||
|
|
|
|||
16
src/core.c
16
src/core.c
|
|
@ -2233,6 +2233,10 @@ void SaveStorageValue(unsigned int position, int value)
|
|||
strcpy(path, CORE.Android.internalDataPath);
|
||||
strcat(path, "/");
|
||||
strcat(path, STORAGE_DATA_FILE);
|
||||
#elif defined(PLATFORM_UWP)
|
||||
strcpy(path, CORE.UWP.internalDataPath);
|
||||
strcat(path, "/");
|
||||
strcat(path, STORAGE_DATA_FILE);
|
||||
#else
|
||||
strcpy(path, STORAGE_DATA_FILE);
|
||||
#endif
|
||||
|
|
@ -2306,6 +2310,10 @@ int LoadStorageValue(unsigned int position)
|
|||
strcpy(path, CORE.Android.internalDataPath);
|
||||
strcat(path, "/");
|
||||
strcat(path, STORAGE_DATA_FILE);
|
||||
#elif defined(PLATFORM_UWP)
|
||||
strcpy(path, CORE.UWP.internalDataPath);
|
||||
strcat(path, "/");
|
||||
strcat(path, STORAGE_DATA_FILE);
|
||||
#else
|
||||
strcpy(path, STORAGE_DATA_FILE);
|
||||
#endif
|
||||
|
|
@ -5371,14 +5379,16 @@ void UWPKeyDownEvent(int key, bool down, bool controlKey)
|
|||
{
|
||||
CORE.Input.Keyboard.currentKeyState[key] = down;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:
|
||||
/*if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_CHARS_QUEUE)
|
||||
void UWPKeyCharEvent(int key)
|
||||
{
|
||||
if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_CHARS_QUEUE)
|
||||
{
|
||||
// Add character to the queue
|
||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = key;
|
||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void UWPMouseButtonEvent(int button, bool down)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
// Determine if UWP functions are set and ready for raylib's use.
|
||||
bool UWPIsConfigured();
|
||||
|
||||
// Call this to set the UWP data path you wish for saving and loading.
|
||||
void UWPSetDataPath(const char* path);
|
||||
|
||||
// Function for getting program time.
|
||||
|
|
@ -75,6 +76,9 @@ void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func);
|
|||
// Call this when a Key is pressed or released.
|
||||
void UWPKeyDownEvent(int key, bool down, bool controlKey);
|
||||
|
||||
// Call this on the CoreWindow::CharacterRecieved event
|
||||
void UWPKeyCharEvent(int key);
|
||||
|
||||
// Call when a mouse button state changes
|
||||
void UWPMouseButtonEvent(int button, bool down);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user