- Treballant en el editor de templates
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "jutil.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
namespace util
|
||||
{
|
||||
int stringToInt(const char *value, std::vector<const char*> strings, std::vector<int> values)
|
||||
@@ -23,4 +23,14 @@ namespace util
|
||||
if (a==nullptr || b==nullptr) return false;
|
||||
return (strcmp(a,b)==0);
|
||||
}
|
||||
|
||||
const uint8_t scancode_to_char(const uint8_t scancode)
|
||||
{
|
||||
if (scancode == SDL_SCANCODE_0 || scancode == SDL_SCANCODE_KP_0) return '0';
|
||||
if (scancode >= SDL_SCANCODE_1 && scancode <= SDL_SCANCODE_9) return scancode+19;
|
||||
if (scancode >= SDL_SCANCODE_KP_1 && scancode <= SDL_SCANCODE_KP_9) return scancode-40;
|
||||
if (scancode >= SDL_SCANCODE_A && scancode <= SDL_SCANCODE_Z) return scancode+61;
|
||||
//if (scancode == SDL_SCANCODE_MINUS) return '-';
|
||||
return '-';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user