f***ed up and needed to rework packages
This commit is contained in:
parent
b43ab1702f
commit
f7a87d7519
78 changed files with 3713 additions and 0 deletions
42
packages/input/glfw/input.c
Normal file
42
packages/input/glfw/input.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#ifdef ARC_GLFW_INPUT
|
||||
#include "arc/input/input.h"
|
||||
|
||||
#include "arc/input/mouse.h"
|
||||
#include "arc/input/keyboard.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
struct ARC_Input {
|
||||
ARC_Keyboard *keyboard;
|
||||
ARC_Mouse *mouse;
|
||||
|
||||
GLFWwindow *window;
|
||||
};
|
||||
|
||||
void ARC_Input_CreateWithEngineData(ARC_Input **input, ARC_EngineData *data){
|
||||
*input = (ARC_Input *)malloc(sizeof(ARC_Input));
|
||||
|
||||
(*input)->event = (SDL_Event *)malloc(sizeof(SDL_Event));
|
||||
|
||||
ARC_Keyboard_CreateWithEngineData(&(*input)->keyboard, data);
|
||||
ARC_Keyboard_CreateWithEngineData(&(*input)->mouse, data);
|
||||
}
|
||||
|
||||
void ARC_Input_Destroy(ARC_Input *input){
|
||||
ARC_Keyboard_Destroy(input->keyboard);
|
||||
ARC_Mouse_Destroy(input->mouse);
|
||||
|
||||
free(input->event);
|
||||
free(input);
|
||||
}
|
||||
|
||||
ARC_Keyboard *ARC_Input_GetKeyboard(ARC_Input *input){
|
||||
return input->keyboard;
|
||||
}
|
||||
|
||||
ARC_Mouse *ARC_Input_GetMouse(ARC_Input *input){
|
||||
return input->mouse;
|
||||
}
|
||||
|
||||
#endif // ARC_SDL2_INPUT
|
||||
23
packages/input/glfw/keyboard.c
Normal file
23
packages/input/glfw/keyboard.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifdef ARC_GLFW_INPUT
|
||||
#include "arc/input/keyboard.h"
|
||||
|
||||
#include "keyboard.h"
|
||||
#include "arc/math/point.h"
|
||||
#include "arc/std/errno.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void ARC_Keyboard_CreateWithInput(ARC_Keyboard **keyboard, ARC_Input *input){
|
||||
}
|
||||
|
||||
void ARC_Keyboard_Destroy(ARC_Keyboard *keyboard){
|
||||
}
|
||||
|
||||
void ARC_Keyboard_Update(ARC_Keyboard *keyboard){
|
||||
}
|
||||
|
||||
ARC_KeyboardState ARC_Keyboard_GetState(ARC_Keyboard *keyboard, enum ARC_KeyboardKey key){
|
||||
return ARC_KEY_NONE;
|
||||
}
|
||||
|
||||
#endif // ARC_GLFW_INPUT
|
||||
21
packages/input/glfw/keyboard.h
Normal file
21
packages/input/glfw/keyboard.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef ARC_GLFW_KEYBOARD_H_
|
||||
#define ARC_GLFW_KEYBOARD_H_
|
||||
|
||||
#ifdef ARC_GLFW_INPUT
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "arc/input/keyboard.h"
|
||||
|
||||
struct ARC_Keyboard {
|
||||
GLFWwindow *window;
|
||||
|
||||
ARC_KeyboardState *keys;
|
||||
ARC_KeyboardState *released;
|
||||
};
|
||||
|
||||
struct ARC_KeyboardInfo {
|
||||
GLFWwindow *window;
|
||||
};
|
||||
|
||||
#endif // !ARC_GLFW_INPUT
|
||||
|
||||
#endif // !ARC_GLFW_KEYBOARD_H_
|
||||
34
packages/input/glfw/mouse.c
Normal file
34
packages/input/glfw/mouse.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#ifdef ARC_GLFW_INPUT
|
||||
#include "arc/input/mouse.h"
|
||||
|
||||
#include "mouse.h"
|
||||
#include "arc/math/point.h"
|
||||
#include "arc/std/errno.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void ARC_Mouse_CreateWithInput(ARC_Keyboard **keyboard, ARC_Input *input){
|
||||
}
|
||||
|
||||
void ARC_Mouse_Destroy(ARC_Mouse *mouse){
|
||||
}
|
||||
|
||||
void ARC_Mouse_UpdateButton(ARC_Mouse *mouse, uint8_t button, uint32_t *buttons, uint32_t mask){
|
||||
}
|
||||
|
||||
void ARC_Mouse_Update(ARC_Mouse *mouse){
|
||||
}
|
||||
|
||||
ARC_Point *ARC_Mouse_GetCoords(ARC_Mouse *mouse){
|
||||
return mouse->coords;
|
||||
}
|
||||
|
||||
ARC_MouseState ARC_Mouse_GetState(ARC_Mouse *mouse, ARC_MouseButton button){
|
||||
return mouse->buttons[button];
|
||||
}
|
||||
|
||||
int32_t *ARC_Mouse_GetScrollY(ARC_Mouse *mouse){
|
||||
return mouse->scrollY;
|
||||
}
|
||||
|
||||
#endif // ARC_SDL_INPUT
|
||||
25
packages/input/glfw/mouse.h
Normal file
25
packages/input/glfw/mouse.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef ARC_GLFW_MOUSE_H_
|
||||
#define ARC_GLFW_MOUSE_H_
|
||||
|
||||
#ifdef ARC_GLFW_INPUT
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "arc/input/mouse.h"
|
||||
#include "arc/math/point.h"
|
||||
|
||||
struct ARC_Mouse {
|
||||
GLFWwindow *window;
|
||||
|
||||
ARC_Point *coords;
|
||||
int32_t *scrollY;
|
||||
|
||||
ARC_MouseState *buttons;
|
||||
uint8_t *buttonsReleased;
|
||||
};
|
||||
|
||||
struct ARC_MouseInfo {
|
||||
GLFWwindow *window;
|
||||
};
|
||||
|
||||
#endif // !ARC_GLFW_INPUT
|
||||
|
||||
#endif // !ARC_GLFW_MOUSE_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue