Rename custom cursor class to avoid conflict with X11 type

This commit is contained in:
2017-01-30 15:05:38 -05:00
parent 73cfe2bd24
commit ac15358c46
4 changed files with 13 additions and 13 deletions

View File

@@ -44,11 +44,11 @@ enum cursor_type {
text_curs, // Keep this one last
};
class Cursor {
class cCursor {
void* ptr;
public:
Cursor(fs::path imgPath, float hotSpotX, float hotSpotY);
~Cursor();
cCursor(fs::path imgPath, float hotSpotX, float hotSpotY);
~cCursor();
void apply();
};

View File

@@ -42,7 +42,7 @@ static NSImage* imageFromURL(CFURLRef url){
return newImage;
}
Cursor::Cursor(fs::path path, float hotSpotX, float hotSpotY){
cCursor::cCursor(fs::path path, float hotSpotX, float hotSpotY){
FSRef ref;
FSPathMakeRef((UInt8*)path.c_str(), &ref, nullptr);
CFURLRef imgPath = CFURLCreateFromFSRef(nullptr, &ref);
@@ -54,11 +54,11 @@ Cursor::Cursor(fs::path path, float hotSpotX, float hotSpotY){
ptr = cursor;
}
Cursor::~Cursor(){
cCursor::~cCursor(){
[(NSCursor*)ptr release];
}
void Cursor::apply(){
void cCursor::apply(){
[(NSCursor*)ptr set];
}
@@ -72,7 +72,7 @@ void set_cursor(cursor_type which_c) {
if(which_c == text_curs) {
[[NSCursor IBeamCursor] set];
} else {
Cursor& curs = *ResMgr::get<CursorRsrc>(cursors[which_c]);
cCursor& curs = *ResMgr::get<CursorRsrc>(cursors[which_c]);
curs.apply();
}
}

View File

@@ -47,7 +47,7 @@ static void GetMaskBitmaps(const sf::Image& srcImage, HBITMAP& hAndMaskBitmap, H
ReleaseDC(NULL, hDC);
}
Cursor::Cursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
cCursor::cCursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
sf::Image gif;
if(!gif.loadFromFile(imgPath.string())) {
std::string error = "Error loading cursor from " + imgPath.string();
@@ -76,12 +76,12 @@ Cursor::Cursor(fs::path imgPath, float hotSpotX, float hotSpotY) {
DeleteObject(cursorXor);
}
Cursor::~Cursor() {
cCursor::~cCursor() {
HCURSOR curs = (HCURSOR)ptr;
DestroyIcon(curs);
}
void Cursor::apply() {
void cCursor::apply() {
HCURSOR curs = (HCURSOR)ptr;
SetCursor(curs);
}
@@ -96,7 +96,7 @@ void set_cursor(cursor_type which_c) {
if(which_c == text_curs) {
SetCursor(LoadCursor(NULL, IDC_IBEAM));
} else {
Cursor& curs = *ResMgr::get<CursorRsrc>(cursors[which_c]);
cCursor& curs = *ResMgr::get<CursorRsrc>(cursors[which_c]);
curs.apply();
}
}

View File

@@ -23,7 +23,7 @@
#include "location.hpp"
using ImageRsrc = sf::Texture;
using CursorRsrc = Cursor;
using CursorRsrc = cCursor;
using FontRsrc = sf::Font;
using StringRsrc = std::vector<std::string>;
using SoundRsrc = sf::SoundBuffer;
@@ -83,7 +83,7 @@ namespace ResMgr {
if(!found_hotspot)
std::cerr << "Cursor hotspot missing: " << fpath.string() << std::endl;
// TODO: Handle errors?
CursorRsrc* cur = new Cursor(fpath.string(),x,y);
CursorRsrc* cur = new cCursor(fpath.string(),x,y);
return cur;
}