Shipwright/libultraship/libultraship/Controller.h
MelonSpeedruns 66ec623542
Free Camera (#337)
* wip free cam

* Almost done, needs collision still

* Added free cam behind cvar

* added WIP collision

* Fixed & implemented "Manual mode" from WW & TP

* Fixed camera not rotating when Link is moving

* fixed initialized camera rotation

* Fixed camera getting stuck + made it smoother

* reduced deadzone

* fixed epona camera height + added WW z-target free camera

* Adjusted player camera height & fixed fov

* Fixed camera roll

* fixed fov when moving the camera while in z-target

* Camera resets to Auto when going through doors or changing maps

* Fixed building

* touch

* more touch work

* Added WIP mouse support to the free cam

* gui stuff

* fixed building

* fixed building error

* ok fixed building for real this time

* oops

* Fix compilation issues

* removed mouse stuff that magically appeared in this branch

* smoothed out stick values & removed remains of mouse support

* re-added manual camera when pressing Z

* reduced minimum Y position of camera

* Addressed dcsv's nitpicks

* part 2

* oops

Co-authored-by: David Chavez <david@dcvz.io>
2022-07-12 18:40:18 -04:00

53 lines
1.3 KiB
C++

#pragma once
#include <memory>
#include <map>
#include <string>
#include <optional>
#include "stdint.h"
#include "UltraController.h"
#include "ControllerAttachment.h"
#define EXTENDED_SCANCODE_BIT (1 << 8)
#define AXIS_SCANCODE_BIT (1 << 9)
namespace Ship {
class Controller {
public:
Controller(int32_t dwControllerNumber);
void Read(OSContPad* pad);
virtual void ReadFromSource() = 0;
virtual void WriteToSource(ControllerCallback* controller) = 0;
virtual bool Connected() const = 0;
virtual bool CanRumble() const = 0;
bool isRumbling;
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
std::shared_ptr<ControllerAttachment> GetAttachment() { return Attachment; }
int32_t GetControllerNumber() { return dwControllerNumber; }
virtual bool HasPadConf() const = 0;
virtual std::optional<std::string> GetPadConfSection() = 0;
protected:
int32_t dwPressedButtons;
std::map<int32_t, int32_t> ButtonMapping;
int8_t wStickX;
int8_t wStickY;
float wGyroX;
float wGyroY;
float wCamX;
float wCamY;
virtual std::string GetControllerType() = 0;
virtual std::string GetConfSection() = 0;
virtual std::string GetBindingConfSection() = 0;
void LoadBinding();
private:
std::shared_ptr<ControllerAttachment> Attachment;
int32_t dwControllerNumber;
};
}