From 79039f90dc0bfa084c9f20033609675fa1a8c258 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 2 Apr 2016 22:23:33 +0900 Subject: [PATCH] SDL cursor functions --- src/sys/ags.cpp | 3 +-- src/sys/ags.h | 4 +--- src/sys/ags_cursor.cpp | 11 +++++------ src/sys/ags_text.cpp | 1 + src/sys/ags_window.cpp | 2 +- src/sys/nact.cpp | 1 - 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/sys/ags.cpp b/src/sys/ags.cpp index bc5b907..d0ebe7b 100644 --- a/src/sys/ags.cpp +++ b/src/sys/ags.cpp @@ -71,7 +71,6 @@ AGS::AGS(NACT* parent) : nact(parent) for(int i = 0; i < 10; i++) { hCursor[i] = NULL; } - hArrow = LoadCursor(NULL, IDC_ARROW); // GAIJI.DAT読み込み memset(gaiji, 0, sizeof(gaiji)); @@ -304,7 +303,7 @@ AGS::~AGS() // カーソル開放 for(int i = 0; i < 10; i++) { if(hCursor[i]) { - DestroyCursor(hCursor[i]); + SDL_FreeCursor(hCursor[i]); } } diff --git a/src/sys/ags.h b/src/sys/ags.h index efc8279..dc2d439 100644 --- a/src/sys/ags.h +++ b/src/sys/ags.h @@ -7,7 +7,6 @@ #ifndef _AGS_H_ #define _AGS_H_ -#include #include #include "../common.h" #include "nact.h" @@ -57,8 +56,7 @@ private: TTF_Font* hFont64; // カーソル - HCURSOR hArrow; - HCURSOR hCursor[10]; + SDL_Cursor* hCursor[10]; // AGS #if defined(_SYSTEM1) diff --git a/src/sys/ags_cursor.cpp b/src/sys/ags_cursor.cpp index c816d0e..31f3dcc 100644 --- a/src/sys/ags_cursor.cpp +++ b/src/sys/ags_cursor.cpp @@ -26,8 +26,6 @@ void AGS::load_cursor(int page) cg_dest_y = j_y; dest_screen = dest; - HINSTANCE hinst = (HINSTANCE)GetModuleHandle(NULL); - // フォントの生成 for(int i = 0; i < 10; i++) { // パターン読み込み @@ -76,18 +74,19 @@ void AGS::load_cursor(int page) } } if(hCursor[i]) { - DestroyCursor(hCursor[i]); + SDL_FreeCursor(hCursor[i]); } - hCursor[i] = CreateCursor(hinst, 2, 2, 32, 32, amask, xmask); + // TODO: fix amask/xmask values + hCursor[i] = SDL_CreateCursor(amask, xmask, 32, 32, 2, 2); } } void AGS::select_cursor() { if(cursor_index == 0) { - SetCursor(hArrow); + SDL_SetCursor(SDL_GetDefaultCursor()); } else if(1 <= cursor_index && cursor_index <= 10 && hCursor[cursor_index - 1]) { - SetCursor(hCursor[cursor_index - 1]); + SDL_SetCursor(hCursor[cursor_index - 1]); } } diff --git a/src/sys/ags_text.cpp b/src/sys/ags_text.cpp index f79204c..35725f7 100644 --- a/src/sys/ags_text.cpp +++ b/src/sys/ags_text.cpp @@ -5,6 +5,7 @@ */ #include "ags.h" +#include void AGS::draw_text(char string[]) { diff --git a/src/sys/ags_window.cpp b/src/sys/ags_window.cpp index 1e2c476..81b0bf8 100644 --- a/src/sys/ags_window.cpp +++ b/src/sys/ags_window.cpp @@ -198,7 +198,7 @@ void AGS::close_text_window(int index, bool update) void AGS::clear_menu_window() { // TODO: use draw function - memset(hBmpScreen[2]->pixels, menu_back_color, 640 * 480 * sizeof(DWORD)); + memset(hBmpScreen[2]->pixels, menu_back_color, 640 * 480 * sizeof(Uint32)); } void AGS::open_menu_window(int index) diff --git a/src/sys/nact.cpp b/src/sys/nact.cpp index b9179c6..7176bdf 100644 --- a/src/sys/nact.cpp +++ b/src/sys/nact.cpp @@ -4,7 +4,6 @@ [ NACT ] */ -#include #include "nact.h" #include "ags.h" #include "mako.h"