mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Remove graphics.h
This commit is contained in:
+2
-2
@@ -33,8 +33,8 @@
|
||||
*/
|
||||
bool gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds, int *dx, int *dy) {
|
||||
if (!ss || !ds) return false;
|
||||
MyRectangle src_window = { 0, 0, ss->width, ss->height };
|
||||
MyRectangle dst_window = { 0, 0, ds->width, ds->height };
|
||||
SDL_Rect src_window = { 0, 0, ss->width, ss->height };
|
||||
SDL_Rect dst_window = { 0, 0, ds->width, ds->height };
|
||||
return ags_clipCopyRect(&src_window, &dst_window, sx, sy, dx, dy, sw, sh);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
#include "ags.h"
|
||||
#include "sprite.h"
|
||||
|
||||
@@ -42,7 +41,7 @@ struct _night {
|
||||
// graph
|
||||
// cginfo_t *cg[CGMAX];
|
||||
|
||||
MyRectangle updaterect;
|
||||
SDL_Rect updaterect;
|
||||
|
||||
FontType fonttype;
|
||||
int fontsize;
|
||||
|
||||
@@ -53,8 +53,8 @@ void nt_gr_set_wallpaper(int no) {
|
||||
sp = nt_sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
|
||||
nt_sp_add_updatelist(sp);
|
||||
if (no == 0) {
|
||||
sp->cursize.width = main_surface->w;
|
||||
sp->cursize.height = main_surface->h;
|
||||
sp->width = main_surface->w;
|
||||
sp->height = main_surface->h;
|
||||
sp->update = nt_sp_draw_wall;
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
char *msg;
|
||||
sprite_t *sp;
|
||||
bool needupdate = false;
|
||||
MyRectangle uparea = {0,0,0,0};
|
||||
SDL_Rect uparea = {0,0,0,0};
|
||||
int savex;
|
||||
|
||||
if (night.msgbuf[0] == '\0') return;
|
||||
@@ -284,8 +284,8 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
|
||||
// Waitなしの出力は最後にupdate
|
||||
if (needupdate) {
|
||||
uparea.w = sp->cursize.width;
|
||||
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
|
||||
uparea.w = sp->width;
|
||||
uparea.h = min(sp->height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace);
|
||||
nt_sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
|
||||
}
|
||||
|
||||
@@ -355,8 +355,8 @@ static void set_align(char *msg, sprite_t *sp, int wSize) {
|
||||
|
||||
maxchar = max(maxchar, c);
|
||||
line++;
|
||||
sp->u.msg.dspcur.x = (sp->cursize.width - (maxchar * wSize/2)) /2;
|
||||
sp->u.msg.dspcur.y = (sp->cursize.height - (line * (wSize+2))) /2;
|
||||
sp->u.msg.dspcur.x = (sp->width - (maxchar * wSize/2)) /2;
|
||||
sp->u.msg.dspcur.y = (sp->height - (line * (wSize+2))) /2;
|
||||
break;
|
||||
case 2:
|
||||
sp->u.msg.dspcur.x = msgframe_2.x;
|
||||
@@ -436,14 +436,14 @@ static void hakanim(int i) {
|
||||
sp->show = show;
|
||||
}
|
||||
|
||||
void ntmsg_update(sprite_t *sp, MyRectangle *r) {
|
||||
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
|
||||
void ntmsg_update(sprite_t *sp, SDL_Rect *r) {
|
||||
SDL_Rect sp_rect = {0, 0, sp->width, sp->height};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = sp->cursize.width;
|
||||
int h = sp->cursize.height;
|
||||
int w = sp->width;
|
||||
int h = sp->height;
|
||||
if (!ags_clipCopyRect(&sp_rect, r, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ void ntmsg_set_place(int type);
|
||||
void ntmsg_newline();
|
||||
void ntmsg_add(const char *msg);
|
||||
int ntmsg_ana(void);
|
||||
void ntmsg_update(sprite_t *sp, MyRectangle *r);
|
||||
void ntmsg_update(sprite_t *sp, SDL_Rect *r);
|
||||
|
||||
#endif /* __NT_MSG_H__ */
|
||||
|
||||
+10
-10
@@ -28,11 +28,11 @@ sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp->cur = sp->loc;
|
||||
|
||||
if (sp->curcg == NULL) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
sp->width = 0;
|
||||
sp->height = 0;
|
||||
} else {
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
sp->width = sp->curcg->sf->w;
|
||||
sp->height = sp->curcg->sf->h;
|
||||
}
|
||||
sp->update = DEFAULT_UPDATE;
|
||||
|
||||
@@ -58,8 +58,8 @@ sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
sp->loc.x = x;
|
||||
sp->loc.y = y;
|
||||
sp->cur = sp->loc;
|
||||
sp->cursize.width = width;
|
||||
sp->cursize.height = height;
|
||||
sp->width = width;
|
||||
sp->height = height;
|
||||
sp->u.msg.dspcur.x = 0;
|
||||
sp->u.msg.dspcur.y = 0;
|
||||
sp->u.msg.canvas = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
@@ -107,11 +107,11 @@ void nt_sp_set_cg(sprite_t *sp, int no) {
|
||||
cg = no ? nt_scg_addref(no) : NULL;
|
||||
|
||||
if (cg == NULL) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
sp->width = 0;
|
||||
sp->height = 0;
|
||||
} else {
|
||||
sp->cursize.width = cg->sf->w;
|
||||
sp->cursize.height = cg->sf->h;
|
||||
sp->width = cg->sf->w;
|
||||
sp->height = cg->sf->h;
|
||||
}
|
||||
|
||||
sp->curcg = cg;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define __SPRITE_H__
|
||||
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
#include <SDL_rect.h>
|
||||
|
||||
#define DEFAULT_UPDATE nt_sp_draw
|
||||
|
||||
@@ -72,7 +72,8 @@ struct _sprite {
|
||||
|
||||
int no;
|
||||
|
||||
MyDimension cursize;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
cginfo_t *curcg;
|
||||
cginfo_t *cg1, *cg2, *cg3;
|
||||
@@ -81,11 +82,11 @@ struct _sprite {
|
||||
|
||||
int blendrate;
|
||||
|
||||
MyPoint loc;
|
||||
SDL_Point loc;
|
||||
|
||||
MyPoint cur;
|
||||
SDL_Point cur;
|
||||
|
||||
void (* update)(struct _sprite *sp, MyRectangle *updatearea);
|
||||
void (* update)(struct _sprite *sp, SDL_Rect *updatearea);
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -97,7 +98,7 @@ struct _sprite {
|
||||
|
||||
struct {
|
||||
struct SDL_Surface *canvas;
|
||||
MyPoint dspcur;
|
||||
SDL_Point dspcur;
|
||||
} msg;
|
||||
} u;
|
||||
};
|
||||
@@ -120,12 +121,12 @@ void nt_sp_updateme(sprite_t *sp);
|
||||
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
void nt_sp_add_updatelist(sprite_t *sp);
|
||||
void nt_sp_remove_updatelist(sprite_t *sp);
|
||||
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_draw_wall(sprite_t *sp, SDL_Rect *r);
|
||||
void nt_sp_clear_updatelist(void);
|
||||
|
||||
/* in nt_sprite_draw.c */
|
||||
void nt_sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_draw(sprite_t *sp, SDL_Rect *r);
|
||||
void nt_sp_draw_scg(sprite_t *sp, SDL_Rect *r);
|
||||
|
||||
/* in nt_sprite_eupdate.c */
|
||||
void nt_sp_eupdate(int type, int time, int cancel);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sprite.h"
|
||||
|
||||
/*
|
||||
@@ -37,7 +36,7 @@
|
||||
@param sp: 描画するスプライト
|
||||
@param r : 再描画する領域
|
||||
*/
|
||||
void nt_sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
void nt_sp_draw(sprite_t *sp, SDL_Rect *r) {
|
||||
if (sp == NULL) return;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
@@ -69,7 +68,7 @@ void nt_sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
}
|
||||
|
||||
// BlendScreenによる描画
|
||||
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
void nt_sp_draw_scg(sprite_t *sp, SDL_Rect *r) {
|
||||
if (sp == NULL) return;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "system.h"
|
||||
#include "list.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sprite.h"
|
||||
|
||||
// スプライト再描画間の間に変更のあったスプライトの領域の和
|
||||
@@ -41,22 +40,22 @@ static SList *updatearea;
|
||||
static SList *updatelist;
|
||||
|
||||
static void disjunction(void* region, void* data);
|
||||
static MyRectangle get_updatearea();
|
||||
static SDL_Rect get_updatearea();
|
||||
static void do_update_each(void* data, void* userdata);
|
||||
|
||||
// 領域1と領域2をすべて含む矩形領域を計算
|
||||
static void disjunction(void* region, void* data) {
|
||||
MyRectangle *r1 = (MyRectangle *)region;
|
||||
MyRectangle *r2 = (MyRectangle *)data;
|
||||
SDL_Rect *r1 = (SDL_Rect *)region;
|
||||
SDL_Rect *r2 = (SDL_Rect *)data;
|
||||
SDL_UnionRect(r1, r2, r2);
|
||||
free(r1);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
static MyRectangle get_updatearea() {
|
||||
MyRectangle clip = {0, 0, 0, 0};
|
||||
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
|
||||
MyRectangle result;
|
||||
static SDL_Rect get_updatearea() {
|
||||
SDL_Rect clip = {0, 0, 0, 0};
|
||||
SDL_Rect screen = {0, 0, main_surface->w, main_surface->h};
|
||||
SDL_Rect result;
|
||||
|
||||
slist_foreach(updatearea, disjunction, &clip);
|
||||
|
||||
@@ -75,7 +74,7 @@ static MyRectangle get_updatearea() {
|
||||
// updatelist に登録してあるすべてのスプライトを更新
|
||||
static void do_update_each(void* data, void* userdata) {
|
||||
sprite_t *sp = (sprite_t *)data;
|
||||
MyRectangle *r = (MyRectangle *)userdata;
|
||||
SDL_Rect *r = (SDL_Rect *)userdata;
|
||||
|
||||
// 非表示の場合はなにもしない
|
||||
if (!sp->show) return;
|
||||
@@ -92,7 +91,7 @@ static void do_update_each(void* data, void* userdata) {
|
||||
*/
|
||||
void nt_sp_update_all(bool syncscreen) {
|
||||
// 画面全体を更新領域に
|
||||
MyRectangle r = {0, 0, main_surface->w, main_surface->h };
|
||||
SDL_Rect r = {0, 0, main_surface->w, main_surface->h };
|
||||
|
||||
// updatelistに登録してあるスプライトを再描画
|
||||
// updatelistはスプライトの番号順に並んでいる
|
||||
@@ -111,7 +110,7 @@ void nt_sp_update_all(bool syncscreen) {
|
||||
updateme(_part)で登録した更新が必要なspriteの和の領域をupdate
|
||||
*/
|
||||
void nt_sp_update_clipped() {
|
||||
MyRectangle r;
|
||||
SDL_Rect r;
|
||||
|
||||
// 更新領域の確定
|
||||
r = get_updatearea();
|
||||
@@ -131,16 +130,16 @@ void nt_sp_update_clipped() {
|
||||
@param sp: 更新するスプライト
|
||||
*/
|
||||
void nt_sp_updateme(sprite_t *sp) {
|
||||
MyRectangle *r;
|
||||
SDL_Rect *r;
|
||||
|
||||
if (sp == NULL) return;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
|
||||
if (sp->width == 0 || sp->height == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r = malloc(sizeof(SDL_Rect));
|
||||
r->x = sp->cur.x;
|
||||
r->y = sp->cur.y;
|
||||
r->w = sp->cursize.width;
|
||||
r->h = sp->cursize.height;
|
||||
r->w = sp->width;
|
||||
r->h = sp->height;
|
||||
|
||||
updatearea = slist_append(updatearea, r);
|
||||
|
||||
@@ -157,12 +156,12 @@ void nt_sp_updateme(sprite_t *sp) {
|
||||
@param h: 更新領域高さ
|
||||
*/
|
||||
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
MyRectangle *r;
|
||||
SDL_Rect *r;
|
||||
|
||||
if (sp == NULL) return;
|
||||
if (w == 0 || h == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r = malloc(sizeof(SDL_Rect));
|
||||
r->x = sp->cur.x + x;
|
||||
r->y = sp->cur.y + y;
|
||||
r->w = w;
|
||||
@@ -204,6 +203,6 @@ void nt_sp_clear_updatelist(void) {
|
||||
}
|
||||
|
||||
// デフォルトの壁紙update
|
||||
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
void nt_sp_draw_wall(sprite_t *sp, SDL_Rect *area) {
|
||||
SDL_FillRect(main_surface, area, SDL_MapRGB(main_surface->format, 0, 0, 0));
|
||||
}
|
||||
|
||||
+11
-11
@@ -25,10 +25,9 @@
|
||||
#define __SACT_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL_rect.h>
|
||||
#include "portab.h"
|
||||
#include "list.h"
|
||||
#include "graphics.h"
|
||||
#include "ags.h"
|
||||
#include "sacttimer.h"
|
||||
#include "variable.h"
|
||||
@@ -107,7 +106,8 @@ struct _sprite {
|
||||
int numsound1, numsound2, numsound3;
|
||||
|
||||
// 初期 sprite の大きさ(cg1の大きさ)
|
||||
MyDimension cursize;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
// それぞれの状態で表示する CG
|
||||
cginfo_t *cg1, *cg2, *cg3;
|
||||
@@ -126,10 +126,10 @@ struct _sprite {
|
||||
int freezed_state;
|
||||
|
||||
// 表示位置 (SetPos)
|
||||
MyPoint loc;
|
||||
SDL_Point loc;
|
||||
|
||||
// 現在のスプライトの表示位置
|
||||
MyPoint cur;
|
||||
SDL_Point cur;
|
||||
|
||||
// event callback
|
||||
int (* eventcb)(struct _sprite *sp, agsevent_t *e); // for key/mouse
|
||||
@@ -146,7 +146,7 @@ struct _sprite {
|
||||
|
||||
// move command 用パラメータ
|
||||
struct {
|
||||
MyPoint to; // 移動先
|
||||
SDL_Point to; // 移動先
|
||||
int time; // 移動完了時間
|
||||
int speed; // 移動速度
|
||||
int starttime; // 移動開始時刻
|
||||
@@ -157,7 +157,7 @@ struct _sprite {
|
||||
// SACT.Numeral用パラメータ
|
||||
struct {
|
||||
int cg[10];
|
||||
MyPoint pos;
|
||||
SDL_Point pos;
|
||||
int span;
|
||||
} numeral;
|
||||
|
||||
@@ -171,7 +171,7 @@ struct _sprite {
|
||||
// ゲットスプライト
|
||||
struct {
|
||||
bool dragging; // ドラッグ中
|
||||
MyPoint dragstart; // ドラッグ開始位置
|
||||
SDL_Point dragstart; // ドラッグ開始位置
|
||||
} get;
|
||||
|
||||
// プットスプライト
|
||||
@@ -191,7 +191,7 @@ struct _sprite {
|
||||
struct {
|
||||
SList *buf; // 表示する文字のリスト
|
||||
struct SDL_Surface *canvas;
|
||||
MyPoint dspcur; // 現在の表示位置
|
||||
SDL_Point dspcur; // 現在の表示位置
|
||||
} msg;
|
||||
} u;
|
||||
};
|
||||
@@ -213,7 +213,7 @@ struct _sact {
|
||||
cginfo_t *cg[CGMAX]; // cgまたはCG_xxで作った CG
|
||||
|
||||
// 座標系の原点
|
||||
MyPoint origin;
|
||||
SDL_Point origin;
|
||||
|
||||
// 文字列 replce 用
|
||||
SList *strreplace;
|
||||
@@ -247,7 +247,7 @@ struct _sact {
|
||||
int movestarttime; // 一斉に移動を開始するための開始時間
|
||||
int movecurtime;
|
||||
|
||||
MyRectangle updaterect; // 更新が必要なspriteの領域の和
|
||||
SDL_Rect updaterect; // 更新が必要なspriteの領域の和
|
||||
|
||||
// sact timer
|
||||
stimer_t timer[65536];
|
||||
|
||||
+11
-11
@@ -145,11 +145,11 @@ void sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
|
||||
// cg1の大きさをスプライトの大きさとする
|
||||
if (sp->curcg == NULL) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
sp->width = 0;
|
||||
sp->height = 0;
|
||||
} else {
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
sp->width = sp->curcg->sf->w;
|
||||
sp->height = sp->curcg->sf->h;
|
||||
}
|
||||
|
||||
sp->freezed_state = 0; // 状態固定は無し
|
||||
@@ -201,8 +201,8 @@ void sp_new_msg(int no, int x, int y, int width, int height) {
|
||||
sp->loc.y = y - sact.origin.y;
|
||||
sp->u.msg.dspcur.x = 0; // 文字描画開始位置
|
||||
sp->u.msg.dspcur.y = 0;
|
||||
sp->cursize.width = width; // スプライトの大きさ
|
||||
sp->cursize.height = height;
|
||||
sp->width = width; // スプライトの大きさ
|
||||
sp->height = height;
|
||||
sp->cur = sp->loc;
|
||||
sp->u.msg.buf = NULL;
|
||||
|
||||
@@ -224,10 +224,10 @@ void sp_set_wall_paper(int no) {
|
||||
|
||||
if (sp->curcg) { // display specified CG
|
||||
sp->update = DEFAULT_UPDATE;
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
sp->width = sp->curcg->sf->w;
|
||||
sp->height = sp->curcg->sf->h;
|
||||
} else { // Black
|
||||
sp->cursize.height = main_surface->h;
|
||||
sp->height = main_surface->h;
|
||||
sp->curcg = NULL;
|
||||
sp->update = sp_draw_wall;
|
||||
}
|
||||
@@ -516,8 +516,8 @@ bool sp_query_size(int wNum, int *vw, int *vh) {
|
||||
|
||||
if (sp->type == SPRITE_NONE) goto errexit;
|
||||
|
||||
*vw = sp->cursize.width;
|
||||
*vh = sp->cursize.height;
|
||||
*vw = sp->width;
|
||||
*vh = sp->height;
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ void sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeou
|
||||
{
|
||||
// とりあえず、現在のマウス位置を送って、switch sprite の
|
||||
// 状態を更新しておく
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
sys_getMouseInfo(&p, false);
|
||||
agsevent_t agse = {
|
||||
.type = AGSEVENT_MOUSE_MOTION,
|
||||
|
||||
@@ -241,7 +241,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
sprite_t *sp;
|
||||
int len = 0; // 処理した文字数?
|
||||
bool needupdate = false;
|
||||
MyRectangle uparea = {0,0,0,0};
|
||||
SDL_Rect uparea = {0,0,0,0};
|
||||
|
||||
// wRSize == 0 -> ルビ無し(SACT.MessageOutputからの呼出)
|
||||
|
||||
@@ -335,8 +335,8 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
|
||||
// Waitなしの出力は最後にupdate
|
||||
if (needupdate) {
|
||||
uparea.w = sp->cursize.width;
|
||||
uparea.h = min(sp->cursize.height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
|
||||
uparea.w = sp->width;
|
||||
uparea.h = min(sp->height, uparea.y - sp->u.msg.dspcur.y + wLineSpace + wLineSpace + wRSize);
|
||||
sp_updateme_part(sp, uparea.x, uparea.y, uparea.w, uparea.h);
|
||||
}
|
||||
|
||||
@@ -447,13 +447,13 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
|
||||
@param sp: 再描画するスプライト
|
||||
*/
|
||||
void smsg_update(sprite_t *sp) {
|
||||
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
|
||||
SDL_Rect sp_rect = {0, 0, sp->width, sp->height};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = sp->cursize.width;
|
||||
int h = sp->cursize.height;
|
||||
int w = sp->width;
|
||||
int h = sp->height;
|
||||
if (!ags_clipCopyRect(&sp_rect, &sact.updaterect, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
@@ -547,10 +547,10 @@ static void set_align(char *msg, sprite_t *sp, int wSize, int wAlign) {
|
||||
|
||||
switch (wAlign) {
|
||||
case 1: // センタリング
|
||||
adjx = (sp->cursize.width - mlen) / 2;
|
||||
adjx = (sp->width - mlen) / 2;
|
||||
break;
|
||||
case 2: // 右寄せ
|
||||
adjx = (sp->cursize.width - mlen);
|
||||
adjx = (sp->width - mlen);
|
||||
break;
|
||||
}
|
||||
sp->u.msg.dspcur.x = max(0, adjx);
|
||||
|
||||
@@ -60,8 +60,8 @@ static int sel_main();
|
||||
* マージン内はsprite内部とは判断しない
|
||||
*/
|
||||
static bool sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
|
||||
MyPoint p = {x, y};
|
||||
MyRectangle r = {
|
||||
SDL_Point p = {x, y};
|
||||
SDL_Rect r = {
|
||||
sp->cur.x + margin,
|
||||
sp->cur.y + margin,
|
||||
sp->curcg->sf->w - 2 * margin,
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "system.h"
|
||||
#include "sdl_core.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
|
||||
@@ -43,16 +42,16 @@ static void do_update_each(void* data, void* userdata);
|
||||
|
||||
// 領域1と領域2をすべて含む矩形領域を計算
|
||||
static void disjunction(void* region, void* data) {
|
||||
MyRectangle *r1 = (MyRectangle *)region;
|
||||
MyRectangle *r2 = (MyRectangle *)data;
|
||||
SDL_Rect *r1 = (SDL_Rect *)region;
|
||||
SDL_Rect *r2 = (SDL_Rect *)data;
|
||||
SDL_UnionRect(r1, r2, r2);
|
||||
free(r1);
|
||||
}
|
||||
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
static void get_updatearea() {
|
||||
MyRectangle clip = {0, 0, 0, 0};
|
||||
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
|
||||
SDL_Rect clip = {0, 0, 0, 0};
|
||||
SDL_Rect screen = {0, 0, main_surface->w, main_surface->h};
|
||||
|
||||
slist_foreach(updatearea, disjunction, &clip);
|
||||
|
||||
@@ -149,16 +148,16 @@ void sp_update_clipped() {
|
||||
@param sp: 更新するスプライト
|
||||
*/
|
||||
void sp_updateme(sprite_t *sp) {
|
||||
MyRectangle *r;
|
||||
SDL_Rect *r;
|
||||
|
||||
if (sp == NULL) return;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
|
||||
if (sp->width == 0 || sp->height == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r = malloc(sizeof(SDL_Rect));
|
||||
r->x = sp->cur.x;
|
||||
r->y = sp->cur.y;
|
||||
r->w = sp->cursize.width;
|
||||
r->h = sp->cursize.height;
|
||||
r->w = sp->width;
|
||||
r->h = sp->height;
|
||||
|
||||
updatearea = slist_append(updatearea, r);
|
||||
|
||||
@@ -175,12 +174,12 @@ void sp_updateme(sprite_t *sp) {
|
||||
@param h: 更新領域高さ
|
||||
*/
|
||||
void sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
MyRectangle *r;
|
||||
SDL_Rect *r;
|
||||
|
||||
if (sp == NULL) return;
|
||||
if (w == 0 || h == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r = malloc(sizeof(SDL_Rect));
|
||||
r->x = sp->cur.x + x;
|
||||
r->y = sp->cur.y + y;
|
||||
r->w = w;
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
|
||||
#define SLOT 40
|
||||
|
||||
static MyRectangle maprect; /* アニメーション表示領域 */
|
||||
static MyRectangle mapback; /* 背景セーブ領域 */
|
||||
static SDL_Rect maprect; /* アニメーション表示領域 */
|
||||
static SDL_Rect mapback; /* 背景セーブ領域 */
|
||||
static int mapback_p5; /* 背景転送先 X */
|
||||
static int mapback_p6; /* 背景転送先 Y */
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifndef __DRAWTEXT_H__
|
||||
#define __DRAWTEXT_H__
|
||||
|
||||
#include "graphics.h"
|
||||
#include "font.h"
|
||||
|
||||
struct SDL_Surface;
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ static void gre_BlendUseAMap(surface_t *dst, int dx, int dy, surface_t *src, int
|
||||
|
||||
void gr_blend_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
|
||||
if (src == NULL || dst == NULL) return;
|
||||
MyRectangle src_window = { 0, 0, src->width, src->height };
|
||||
MyRectangle dst_window = { 0, 0, dst->width, dst->height };
|
||||
SDL_Rect src_window = { 0, 0, src->width, src->height };
|
||||
SDL_Rect dst_window = { 0, 0, dst->width, dst->height };
|
||||
if (!ags_clipCopyRect(&src_window, &dst_window, &sx, &sy, &dx, &dy, &sw, &sh)) return;
|
||||
|
||||
if (src->alpha == NULL) {
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct {
|
||||
|
||||
static void *mapdata[NUM_MAPS];
|
||||
static int setChipParam_index;
|
||||
static MyRectangle chip_params[NUM_LAYERS];
|
||||
static SDL_Rect chip_params[NUM_LAYERS];
|
||||
static int window_width;
|
||||
static int window_height;
|
||||
static int map_width;
|
||||
@@ -68,7 +68,7 @@ static void MakeMapSetChipParam() {
|
||||
WARNING("unexpected MakeMapSeChipParam call");
|
||||
return;
|
||||
}
|
||||
MyRectangle *r = &chip_params[setChipParam_index++];
|
||||
SDL_Rect *r = &chip_params[setChipParam_index++];
|
||||
r->x = p1;
|
||||
r->y = p2;
|
||||
r->w = p3;
|
||||
@@ -93,9 +93,9 @@ static void MakeMapDraw() {
|
||||
int c1 = a1[index];
|
||||
int c2 = a2[index];
|
||||
int c3 = a3[index];
|
||||
MyRectangle *r1 = &chip_params[0];
|
||||
MyRectangle *r2 = &chip_params[1];
|
||||
MyRectangle *r3 = &chip_params[2];
|
||||
SDL_Rect *r1 = &chip_params[0];
|
||||
SDL_Rect *r2 = &chip_params[1];
|
||||
SDL_Rect *r3 = &chip_params[2];
|
||||
surface_t *dib = ags_getDIB();
|
||||
if (c3) {
|
||||
ags_copyArea(r3->x + c3 * r3->w, r3->y, r3->w, r3->h, dstX + x * r3->w, dstY + y * r3->h);
|
||||
|
||||
@@ -87,20 +87,20 @@ static void initPal(void) {
|
||||
}
|
||||
|
||||
bool ags_check_param(int *x, int *y, int *w, int *h) {
|
||||
if (*x >= nact->ags.world_size.width) {
|
||||
WARNING("Illegal Param x = %d (max=%d)(@%03x:%05x)", *x, nact->ags.world_size.width, sl_getPage(), sl_getIndex());
|
||||
if (*x >= nact->ags.world_width) {
|
||||
WARNING("Illegal Param x = %d (max=%d)(@%03x:%05x)", *x, nact->ags.world_width, sl_getPage(), sl_getIndex());
|
||||
return false;
|
||||
}
|
||||
if (*y >= nact->ags.world_size.height) {
|
||||
WARNING("Illegal Param y = %d (max=%d)", *y, nact->ags.world_size.height);
|
||||
if (*y >= nact->ags.world_height) {
|
||||
WARNING("Illegal Param y = %d (max=%d)", *y, nact->ags.world_height);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*x < 0) { *w += *x; *x = 0; }
|
||||
if (*y < 0) { *h += *y; *y = 0; }
|
||||
|
||||
if ((*x + *w) > nact->ags.world_size.width) { *w = nact->ags.world_size.width - *x;}
|
||||
if ((*y + *h) > nact->ags.world_size.height) { *h = nact->ags.world_size.height - *y;}
|
||||
if ((*x + *w) > nact->ags.world_width) { *w = nact->ags.world_width - *x;}
|
||||
if ((*y + *h) > nact->ags.world_height) { *h = nact->ags.world_height - *y;}
|
||||
|
||||
if (*w <= 0) return false;
|
||||
if (*h <= 0) return false;
|
||||
@@ -109,11 +109,11 @@ bool ags_check_param(int *x, int *y, int *w, int *h) {
|
||||
}
|
||||
|
||||
bool ags_check_param_xy(int *x, int *y) {
|
||||
if (*x >= nact->ags.world_size.width) {
|
||||
if (*x >= nact->ags.world_width) {
|
||||
WARNING("Illegal Param x = %d", *x);
|
||||
return false;
|
||||
}
|
||||
if (*y >= nact->ags.world_size.height) {
|
||||
if (*y >= nact->ags.world_height) {
|
||||
WARNING("Illegal Param y = %d", *y);
|
||||
return false;
|
||||
}
|
||||
@@ -126,8 +126,8 @@ bool ags_check_param_xy(int *x, int *y) {
|
||||
|
||||
void ags_init(const char *render_driver, bool enable_zb) {
|
||||
nact->ags.mouse_warp_enabled = true;
|
||||
nact->ags.world_size.width = SYS35_DEFAULT_WIDTH;
|
||||
nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT;
|
||||
nact->ags.world_width = SYS35_DEFAULT_WIDTH;
|
||||
nact->ags.world_height = SYS35_DEFAULT_HEIGHT;
|
||||
nact->ags.world_depth = SYS35_DEFAULT_DEPTH;
|
||||
nact->ags.view_area.x = 0;
|
||||
nact->ags.view_area.y = 0;
|
||||
@@ -160,8 +160,8 @@ void ags_reset(void) {
|
||||
}
|
||||
|
||||
void ags_setWorldSize(int width, int height, int depth) {
|
||||
nact->ags.world_size.width = width;
|
||||
nact->ags.world_size.height = height;
|
||||
nact->ags.world_width = width;
|
||||
nact->ags.world_height = height;
|
||||
nact->ags.world_depth = depth;
|
||||
|
||||
if (nact->ags.dib && nact->ags.dib->alpha) {
|
||||
@@ -199,19 +199,19 @@ void ags_setWindowTitle(const char *title_utf8) {
|
||||
}
|
||||
|
||||
void ags_getDIBInfo(DispInfo *info) {
|
||||
info->width = nact->ags.world_size.width;
|
||||
info->height = nact->ags.world_size.height;
|
||||
info->width = nact->ags.world_width;
|
||||
info->height = nact->ags.world_height;
|
||||
info->depth = nact->ags.world_depth;
|
||||
}
|
||||
|
||||
void ags_getViewAreaInfo(DispInfo *info) {
|
||||
gfx_getWindowInfo(info);
|
||||
gfx_getWindowInfo(NULL, NULL, &info->depth);
|
||||
info->width = nact->ags.view_area.w;
|
||||
info->height = nact->ags.view_area.h;
|
||||
}
|
||||
|
||||
void ags_getWindowInfo(DispInfo *info) {
|
||||
gfx_getWindowInfo(info);
|
||||
gfx_getWindowInfo(&info->width, &info->height, &info->depth);
|
||||
}
|
||||
|
||||
void ags_setExposeSwitch(bool expose) {
|
||||
@@ -222,9 +222,9 @@ void ags_updateArea(int x, int y, int w, int h) {
|
||||
if (fade_outed || !need_update)
|
||||
return;
|
||||
|
||||
MyRectangle r = {x, y, w, h}, update;
|
||||
SDL_Rect r = {x, y, w, h}, update;
|
||||
if (SDL_IntersectRect(&nact->ags.view_area, &r, &update)) {
|
||||
MyPoint p = {
|
||||
SDL_Point p = {
|
||||
update.x - nact->ags.view_area.x,
|
||||
update.y - nact->ags.view_area.y
|
||||
};
|
||||
@@ -236,13 +236,13 @@ void ags_updateFull() {
|
||||
if (fade_outed || !need_update)
|
||||
return;
|
||||
|
||||
MyRectangle r = {
|
||||
SDL_Rect r = {
|
||||
nact->ags.view_area.x,
|
||||
nact->ags.view_area.y,
|
||||
min(nact->ags.view_area.w, nact->ags.world_size.width),
|
||||
min(nact->ags.view_area.h, nact->ags.world_size.height)
|
||||
min(nact->ags.view_area.w, nact->ags.world_width),
|
||||
min(nact->ags.view_area.h, nact->ags.world_height)
|
||||
};
|
||||
MyPoint p = {0, 0};
|
||||
SDL_Point p = {0, 0};
|
||||
gfx_updateArea(&r, &p);
|
||||
}
|
||||
|
||||
@@ -313,10 +313,15 @@ void ags_wrapColor(int x, int y, int w, int h, int p1, int p2) {
|
||||
gfx_wrapColor(x, y, w, h, p1, p2);
|
||||
}
|
||||
|
||||
void ags_getPixel(int x, int y, Palette *cell) {
|
||||
void ags_getPixel(int x, int y, PixelColor *cell) {
|
||||
if (!ags_check_param_xy(&x, &y)) return;
|
||||
|
||||
gfx_getPixel(x, y, cell);
|
||||
uint32_t pixel = gfx_getPixel(x, y);
|
||||
if (main_surface->format->BitsPerPixel == 8) {
|
||||
cell->index = pixel;
|
||||
} else {
|
||||
SDL_GetRGB(pixel, main_surface->format, &cell->r, &cell->g, &cell->b);
|
||||
}
|
||||
}
|
||||
|
||||
void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, uint8_t sprite) {
|
||||
@@ -383,7 +388,7 @@ void ags_delRegion(void *region) {
|
||||
gfx_delRegion(region);
|
||||
}
|
||||
|
||||
int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out) {
|
||||
int ags_drawString(int x, int y, const char *src, int col, SDL_Rect *rect_out) {
|
||||
if (!ags_check_param_xy(&x, &y)) {
|
||||
if (rect_out) {
|
||||
rect_out->x = x;
|
||||
@@ -394,7 +399,7 @@ int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out
|
||||
return 0;
|
||||
}
|
||||
|
||||
MyRectangle adj;
|
||||
SDL_Rect adj;
|
||||
char *utf8 = toUTF8(src);
|
||||
switch(nact->ags.text_decoration_type) {
|
||||
case TEXT_DECORATION_NONE:
|
||||
@@ -509,9 +514,9 @@ void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int l
|
||||
gfx_copyAreaSP16_alphaBlend(sx, sy, w, h, dx, dy, lv);
|
||||
}
|
||||
|
||||
MyRectangle ags_floodFill(int x, int y, int col) {
|
||||
SDL_Rect ags_floodFill(int x, int y, int col) {
|
||||
if (!ags_check_param_xy(&x, &y))
|
||||
return (MyRectangle){};
|
||||
return (SDL_Rect){};
|
||||
|
||||
return gfx_floodFill(x, y, col);
|
||||
}
|
||||
@@ -722,7 +727,7 @@ void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
|
||||
}
|
||||
#else
|
||||
if (nact->ags.mouse_warp_enabled) {
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
sys_getMouseInfo(&p, is_dibgeo);
|
||||
int dx = x - p.x;
|
||||
int dy = y - p.y;
|
||||
@@ -778,7 +783,7 @@ void ags_autorepeat(bool enable) {
|
||||
sdl_setAutoRepeat(enable);
|
||||
}
|
||||
|
||||
bool ags_clipCopyRect(const MyRectangle *sw, const MyRectangle *dw, int *sx, int *sy, int *dx, int *dy, int *w, int *h) {
|
||||
bool ags_clipCopyRect(const SDL_Rect *sw, const SDL_Rect *dw, int *sx, int *sy, int *dx, int *dy, int *w, int *h) {
|
||||
// Clip source rectangle to source window
|
||||
SDL_Rect sr = {*sx, *sy, *w, *h};
|
||||
if (!SDL_IntersectRect(&sr, sw, &sr))
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <SDL_surface.h>
|
||||
#include "portab.h"
|
||||
#include "cg.h"
|
||||
#include "graphics.h"
|
||||
#include "font.h"
|
||||
|
||||
/* マウスカーソルの種類 */
|
||||
#define CURSOR_ARROW 1
|
||||
@@ -111,13 +111,26 @@ typedef enum {
|
||||
TEXT_DECORATION_DROP_SHADOW_OUTLINE = 10,
|
||||
} TextDecorationType;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t r, g, b;
|
||||
uint32_t index;
|
||||
} PixelColor;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
} DispInfo;
|
||||
|
||||
struct _ags {
|
||||
SDL_Color pal[256]; /* system palette */
|
||||
bool pal_changed; /* system palette has changed */
|
||||
|
||||
MyDimension world_size; /* size of off-screen */
|
||||
|
||||
MyRectangle view_area; /* view region in off-screen */
|
||||
int world_width;
|
||||
int world_height;
|
||||
|
||||
SDL_Rect view_area; /* view region in off-screen */
|
||||
|
||||
int world_depth; /* depth of off-screen (bits per pixel) */
|
||||
|
||||
@@ -174,7 +187,7 @@ extern void ags_copyAreaSP(int sx, int sy, int w, int h, int dx, int dy, int col
|
||||
extern void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, int dy, int lv);
|
||||
|
||||
extern void ags_wrapColor(int x, int y, int w, int h, int p1, int p2);
|
||||
extern void ags_getPixel(int x, int y, Palette *cell);
|
||||
extern void ags_getPixel(int x, int y, PixelColor *cell);
|
||||
extern void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, uint8_t sprite);
|
||||
extern void ags_changeColorArea(int x, int y, int w, int h, int dst, int src, int cnt);
|
||||
|
||||
@@ -183,14 +196,14 @@ extern void ags_restoreRegion(void *region, int x, int y);
|
||||
extern void ags_putRegion(void *region, int x, int y);
|
||||
extern void ags_delRegion(void *region);
|
||||
|
||||
extern int ags_drawString(int x, int y, const char *src, int col, MyRectangle *rect_out);
|
||||
extern int ags_drawString(int x, int y, const char *src, int col, SDL_Rect *rect_out);
|
||||
extern void ags_drawCg(cgdata *cg, int x, int y, int brightness, int sprite_color, bool alpha_blend);
|
||||
|
||||
extern void ags_copyArea_shadow(int sx, int sy, int w, int h, int dx, int dy);
|
||||
extern void ags_copyArea_transparent(int sx, int sy, int w, int h, int dx, int dy, int col);
|
||||
extern void ags_copyArea_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int lv);
|
||||
extern void ags_copyArea_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, int lv);
|
||||
extern MyRectangle ags_floodFill(int x, int y, int col);
|
||||
extern SDL_Rect ags_floodFill(int x, int y, int col);
|
||||
extern void ags_eCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt, bool cancel);
|
||||
extern void ags_eSpriteCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt, bool cancel, int spCol);
|
||||
|
||||
@@ -228,7 +241,7 @@ extern int ags_getCursorMoveTime();
|
||||
extern void ags_setAntialiasedStringMode(bool mode);
|
||||
extern bool ags_getAntialiasedStringMode();
|
||||
extern void ags_autorepeat(bool enable);
|
||||
extern bool ags_clipCopyRect(const MyRectangle *sr, const MyRectangle *dr, int *sx, int *sy, int *dx, int *dy, int *w, int *h);
|
||||
extern bool ags_clipCopyRect(const SDL_Rect *sr, const SDL_Rect *dr, int *sx, int *sy, int *dx, int *dy, int *w, int *h);
|
||||
|
||||
typedef void (*ags_EffectStepFunc)(void *, float);
|
||||
void ags_runEffect(int duration_ms, bool cancelable, ags_EffectStepFunc step, void *arg);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "portab.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "graphics.h"
|
||||
#include "cg.h"
|
||||
#include "bmp.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <SDL.h>
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "graphics.h"
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "cg.h"
|
||||
@@ -57,7 +56,7 @@ int cg_brightness;
|
||||
|
||||
/* CG表示位置に関する情報 */
|
||||
static CG_WHERETODISP loc_policy, loc_policy0;
|
||||
static MyPoint loc_where, loc_where0;
|
||||
static SDL_Point loc_where, loc_where0;
|
||||
|
||||
/* extracted cg data cache control object */
|
||||
static cacher *cacheid;
|
||||
@@ -65,7 +64,7 @@ static cacher *cacheid;
|
||||
/* static methods */
|
||||
static CG_TYPE check_cgformat(uint8_t *data);
|
||||
static void set_vspbank(uint8_t *pic, int bank, int width, int height);
|
||||
static MyPoint set_display_loc(cgdata *cg);
|
||||
static SDL_Point set_display_loc(cgdata *cg);
|
||||
static void clear_display_loc();
|
||||
static void display_cg(cgdata *cg, int x, int y, int sprite_color, bool alpha_blend);
|
||||
static cgdata *loader(int no);
|
||||
@@ -131,8 +130,8 @@ void cgdata_free(cgdata *cg) {
|
||||
* cg: cg information
|
||||
* return: x and y for display location
|
||||
*/
|
||||
static MyPoint set_display_loc(cgdata *cg) {
|
||||
MyPoint p;
|
||||
static SDL_Point set_display_loc(cgdata *cg) {
|
||||
SDL_Point p;
|
||||
|
||||
switch(loc_policy) {
|
||||
case OFFSET_ABSOLUTE_GC:
|
||||
@@ -288,7 +287,7 @@ void cg_set_display_location(int x, int y, CG_WHERETODISP policy) {
|
||||
*/
|
||||
void cg_load(int no, int flg) {
|
||||
cgdata *cg;
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
int i, bank = cg_vspPB;
|
||||
|
||||
/* load and extract cg */
|
||||
@@ -361,7 +360,7 @@ void cg_load(int no, int flg) {
|
||||
*/
|
||||
void cg_load_with_alpha(int cgno, int shadowno) {
|
||||
cgdata *cg = NULL, *scg;
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
|
||||
/* load pixel */
|
||||
if (cgno >= 0) {
|
||||
@@ -441,7 +440,7 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
long filesize;
|
||||
uint8_t *data;
|
||||
cgdata *cg = NULL;
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
|
||||
data = load_cg_from_file(fname_utf8, &status, &filesize);
|
||||
if (data == NULL) return status;
|
||||
@@ -490,9 +489,9 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
* no : file no for cg ( >= 0 )
|
||||
* info: information to be retored
|
||||
*/
|
||||
void cg_get_info(int no, MyRectangle *info) {
|
||||
void cg_get_info(int no, SDL_Rect *info) {
|
||||
cgdata *cg = loader(no);
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
|
||||
if (cg == NULL) {
|
||||
info->x = info->y = info->w = info->h = 0;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#ifndef __CG__
|
||||
#define __CG__
|
||||
|
||||
#include <SDL_rect.h>
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct SDL_Surface;
|
||||
|
||||
@@ -80,7 +80,7 @@ extern void cg_set_display_location(int x, int y, CG_WHERETODISP policy);
|
||||
extern void cg_load(int no, int flg);
|
||||
extern void cg_load_with_alpha(int cgno, int shadowno);
|
||||
extern int cg_load_with_filename(char *fname_utf8, int x, int y);
|
||||
extern void cg_get_info(int no, MyRectangle *info);
|
||||
extern void cg_get_info(int no, SDL_Rect *info);
|
||||
extern void cg_clear_display_loc();
|
||||
extern void cgdata_free(cgdata *cg);
|
||||
extern struct SDL_Surface *cg_load_as_sdlsurface(int no);
|
||||
|
||||
+3
-3
@@ -108,7 +108,7 @@ void commands2F04() {
|
||||
|
||||
void commands2F05() {
|
||||
/* 現在のテキスト表示位置をスタックにプッシュする */
|
||||
MyPoint loc;
|
||||
SDL_Point loc;
|
||||
msg_getMessageLocation(&loc);
|
||||
sl_pushTextLoc(loc.x, loc.y);
|
||||
TRACE("TPP:");
|
||||
@@ -782,8 +782,8 @@ void commands2F4C() {
|
||||
int eWidth = getCaliValue();
|
||||
int eHeight = getCaliValue();
|
||||
|
||||
MyRectangle r = {eSrcX, eSrcY, eWidth, eHeight};
|
||||
MyPoint p = {eX, eY};
|
||||
SDL_Rect r = {eSrcX, eSrcY, eWidth, eHeight};
|
||||
SDL_Point p = {eX, eY};
|
||||
|
||||
gfx_updateArea(&r, &p);
|
||||
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ void commandB4() {
|
||||
}
|
||||
|
||||
void commandB10() {
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ void commandCP() {
|
||||
int y = getCaliValue();
|
||||
int color = getCaliValue();
|
||||
|
||||
MyRectangle rec = ags_floodFill(x, y, color);
|
||||
SDL_Rect rec = ags_floodFill(x, y, color);
|
||||
if (!SDL_RectEmpty(&rec))
|
||||
ags_updateArea(rec.x, rec.y, rec.w, rec.h);
|
||||
|
||||
|
||||
+6
-7
@@ -26,10 +26,9 @@
|
||||
#include "xsystem35.h"
|
||||
#include "scenario.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
|
||||
typedef struct {
|
||||
MyRectangle r;
|
||||
SDL_Rect r;
|
||||
int pal;
|
||||
} Ecomtbl;
|
||||
|
||||
@@ -55,7 +54,7 @@ void commandES() {
|
||||
void commandEC() {
|
||||
int num = getCaliValue();
|
||||
Ecomtbl *e;
|
||||
MyRectangle *r;
|
||||
SDL_Rect *r;
|
||||
|
||||
if (num == 0) {
|
||||
r = &nact->ags.view_area;
|
||||
@@ -91,8 +90,8 @@ void commandEM() {
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
|
||||
MyPoint p = {x, y};
|
||||
MyRectangle r = tbl[num - 1].r;
|
||||
SDL_Point p = {x, y};
|
||||
SDL_Rect r = tbl[num - 1].r;
|
||||
if (nact->patch_emen == 0) {
|
||||
r.w -= 1;
|
||||
r.h -= 1;
|
||||
@@ -108,11 +107,11 @@ void commandEN() {
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
|
||||
MyPoint p = {x, y};
|
||||
SDL_Point p = {x, y};
|
||||
*var = 0;
|
||||
|
||||
for (int i = min; i <= max; i++) {
|
||||
MyRectangle r = tbl[i - 1].r;
|
||||
SDL_Rect r = tbl[i - 1].r;
|
||||
if (nact->patch_emen == 0) {
|
||||
r.w -= 1;
|
||||
r.h -= 1;
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ void commandG1() {
|
||||
|
||||
void commandGS() {
|
||||
/* num 番にリンクされているCGの座標とサイズを取得する */
|
||||
MyRectangle r;
|
||||
SDL_Rect r;
|
||||
int num = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ void commandIM() {
|
||||
/* マウスカーソルの座標取得 */
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
|
||||
sysVar[0] = sys_getMouseInfo(&p, false);
|
||||
*x_var = p.x;
|
||||
|
||||
+4
-4
@@ -156,10 +156,10 @@ void commandPT0() {
|
||||
int *var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Palette cell;
|
||||
PixelColor cell;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
*var = cell.pixel;
|
||||
*var = cell.index;
|
||||
|
||||
TRACE("PT0 %p,%d,%d:", var, x, y);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ void commandPT1() {
|
||||
int *b_var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Palette cell;
|
||||
PixelColor cell;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
*r_var = cell.r;
|
||||
@@ -187,7 +187,7 @@ void commandPT2() {
|
||||
int *low_var = getCaliVariable();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
Palette cell;
|
||||
PixelColor cell;
|
||||
int r, g, b, pic;
|
||||
|
||||
ags_getPixel(x, y, &cell);
|
||||
|
||||
+3
-3
@@ -47,8 +47,8 @@ static bool ecp_cancel;
|
||||
|
||||
|
||||
static void eCopyUpdateArea(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
MyRectangle src = {sx, sy, w, h};
|
||||
MyPoint dst = {
|
||||
SDL_Rect src = {sx, sy, w, h};
|
||||
SDL_Point dst = {
|
||||
dx - nact->ags.view_area.x,
|
||||
dy - nact->ags.view_area.y
|
||||
};
|
||||
@@ -364,7 +364,7 @@ void ags_eCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt
|
||||
case 54:
|
||||
ags_copyArea(sx, sy, w, h, dx, dy);
|
||||
{
|
||||
MyRectangle r = {dx, dy, w, h}, update;
|
||||
SDL_Rect r = {dx, dy, w, h}, update;
|
||||
SDL_IntersectRect(&nact->ags.view_area, &r, &update);
|
||||
w = update.w;
|
||||
h = update.h;
|
||||
|
||||
+6
-1
@@ -27,7 +27,12 @@
|
||||
#include <SDL_surface.h>
|
||||
#include "config.h"
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
|
||||
typedef enum {
|
||||
FONT_GOTHIC,
|
||||
FONT_MINCHO,
|
||||
} FontType;
|
||||
#define FONTTYPEMAX 2
|
||||
|
||||
#define FONT_WEIGHT_NORMAL 4
|
||||
#define FONT_WEIGHT_BOLD 7
|
||||
|
||||
@@ -33,7 +33,7 @@ void gfx_Remove(void);
|
||||
void gfx_setWorldSize(int width, int height, int depth);
|
||||
void gfx_setWindowSize(int w, int h);
|
||||
void gfx_setWindowTitle(char *name);
|
||||
void gfx_getWindowInfo(DispInfo *info);
|
||||
void gfx_getWindowInfo(int *width, int *height, int *depth);
|
||||
void gfx_setFullscreen(bool on);
|
||||
bool gfx_isFullscreen(void);
|
||||
void gfx_raiseWindow(void);
|
||||
@@ -42,8 +42,8 @@ void gfx_setIntegerScaling(bool enable);
|
||||
SDL_Surface *gfx_createSurfaceView(SDL_Surface *sf, int x, int y, int w, int h);
|
||||
|
||||
/* 画面更新 */
|
||||
void gfx_updateArea(MyRectangle *src, MyPoint *dst);
|
||||
void gfx_updateAll(MyRectangle *view_rect);
|
||||
void gfx_updateArea(SDL_Rect *src, SDL_Point *dst);
|
||||
void gfx_updateAll(SDL_Rect *view_rect);
|
||||
void gfx_updateScreen(void);
|
||||
|
||||
/* パレット関係 */
|
||||
@@ -70,7 +70,7 @@ void gfx_copyAreaSP16_alphaBlend(int sx, int sy, int w, int h, int dx, int dy, i
|
||||
void gfx_copyAreaSP16_alphaLevel(int sx, int sy, int w, int h, int dx, int dy, int lv);
|
||||
void gfx_copy_from_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
|
||||
void gfx_copy_to_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_COPY_TYPE flag);
|
||||
void gfx_getPixel(int x, int y, Palette *cell);
|
||||
uint32_t gfx_getPixel(int x, int y);
|
||||
void gfx_putRegion(void *src, int x, int y);
|
||||
void gfx_restoreRegion(void *src, int x, int y);
|
||||
void* gfx_saveRegion(int x, int y, int w, int h);
|
||||
|
||||
+3
-3
@@ -104,7 +104,7 @@ void sdl_wait_vsync() {
|
||||
}
|
||||
|
||||
/* off-screen の指定領域を Main Window へ転送 */
|
||||
void gfx_updateArea(MyRectangle *rect, MyPoint *dst) {
|
||||
void gfx_updateArea(SDL_Rect *rect, SDL_Point *dst) {
|
||||
SDL_Rect sw = {0, 0, main_surface->w, main_surface->h};
|
||||
SDL_Rect dw = {0, 0, view_w, view_h};
|
||||
SDL_Rect sr = {rect->x, rect->y, rect->w, rect->h};
|
||||
@@ -123,8 +123,8 @@ void gfx_updateArea(MyRectangle *rect, MyPoint *dst) {
|
||||
}
|
||||
|
||||
/* 全画面更新 */
|
||||
void gfx_updateAll(MyRectangle *view_rect) {
|
||||
gfx_updateArea(view_rect, &(MyPoint){0, 0});
|
||||
void gfx_updateAll(SDL_Rect *view_rect) {
|
||||
gfx_updateArea(view_rect, &(SDL_Point){0, 0});
|
||||
}
|
||||
|
||||
/* Color の複数個指定 */
|
||||
|
||||
+14
-25
@@ -227,35 +227,24 @@ void gfx_copy_to_alpha(int sx, int sy, int w, int h, int dx, int dy, ALPHA_DIB_C
|
||||
/*
|
||||
* dib のピクセル情報を取得
|
||||
*/
|
||||
void gfx_getPixel(int x, int y, Palette *cell) {
|
||||
uint32_t gfx_getPixel(int x, int y) {
|
||||
uint8_t *p = PIXEL_AT(main_surface, x, y);
|
||||
if (main_surface->format->BitsPerPixel == 8) {
|
||||
cell->pixel = *p;
|
||||
} else {
|
||||
Uint32 cl=0;
|
||||
|
||||
switch (main_surface->format->BytesPerPixel) {
|
||||
case 2:
|
||||
{
|
||||
unsigned short *pp = (unsigned short *)p;
|
||||
cl = *pp;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
||||
switch (main_surface->format->BytesPerPixel) {
|
||||
case 1:
|
||||
return *p;
|
||||
case 2:
|
||||
return *(unsigned short *)p;
|
||||
case 3:
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
cl = (p[2]<<16)+(p[1]<<8) + p[0];
|
||||
return (p[2]<<16)+(p[1]<<8) + p[0];
|
||||
#else
|
||||
cl = (p[0]<<16)+(p[1]<<8) + p[2];
|
||||
return (p[0]<<16)+(p[1]<<8) + p[2];
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
Uint32 *pp = (Uint32 *)p;
|
||||
cl = *pp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
SDL_GetRGB(cl, main_surface->format, &cell->r, &cell->g, &cell->b);
|
||||
case 4:
|
||||
return *(Uint32 *)p;
|
||||
default:
|
||||
return 0; // cannot happen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -211,12 +211,12 @@ void gfx_setWorldSize(int width, int height, int depth) {
|
||||
}
|
||||
|
||||
/* display の size と depth の取得 */
|
||||
void gfx_getWindowInfo(DispInfo *info) {
|
||||
void gfx_getWindowInfo(int *width, int *height, int *depth) {
|
||||
SDL_DisplayMode dm;
|
||||
SDL_GetCurrentDisplayMode(0, &dm);
|
||||
info->width = dm.w;
|
||||
info->height = dm.h;
|
||||
info->depth = SDL_BITSPERPIXEL(dm.format);
|
||||
if (width) *width = dm.w;
|
||||
if (height) *height = dm.h;
|
||||
if (depth) *depth = SDL_BITSPERPIXEL(dm.format);
|
||||
}
|
||||
|
||||
/* DIBの取得 */
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* graphics.h graphics related definition
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: graphics.h,v 1.24 2000/11/25 13:09:04 chikama Exp $ */
|
||||
|
||||
#ifndef __GRAPHICS__
|
||||
#define __GRAPHICS__
|
||||
|
||||
#include "portab.h"
|
||||
#include <SDL_rect.h>
|
||||
#include <SDL_pixels.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t r,g,b;
|
||||
uint32_t pixel;
|
||||
} Palette;
|
||||
|
||||
typedef SDL_Point MyPoint;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
} MyDimension;
|
||||
|
||||
typedef SDL_Rect MyRectangle;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
} DispInfo;
|
||||
|
||||
typedef enum {
|
||||
FONT_GOTHIC,
|
||||
FONT_MINCHO,
|
||||
} FontType;
|
||||
#define FONTTYPEMAX 2
|
||||
|
||||
#endif /* !__GRAPHICS__ */
|
||||
+2
-2
@@ -51,8 +51,8 @@ void set_hak_keymode(int key, int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
int sys_getMouseInfo(MyPoint *p, bool is_dibgeo) {
|
||||
MyPoint _p;
|
||||
int sys_getMouseInfo(SDL_Point *p, bool is_dibgeo) {
|
||||
SDL_Point _p;
|
||||
int key = sdl_getMouseInfo(&_p);
|
||||
|
||||
if (p) {
|
||||
|
||||
+3
-2
@@ -25,7 +25,8 @@
|
||||
#define __INPUT__
|
||||
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct SDL_Point;
|
||||
|
||||
#define SYS35KEY_NULL 0
|
||||
#define SYS35KEY_UP 1
|
||||
@@ -159,7 +160,7 @@ enum keycode {
|
||||
extern bool RawKeyInfo[NUM_KEYCODES];
|
||||
|
||||
extern int sys_keywait(int msec, unsigned flags);
|
||||
extern int sys_getMouseInfo(MyPoint *p, bool is_dibgeo);
|
||||
extern int sys_getMouseInfo(struct SDL_Point *p, bool is_dibgeo);
|
||||
extern int sys_getInputInfo(void);
|
||||
extern int sys_getKeyInfo(void);
|
||||
extern int sys_getJoyInfo(void);
|
||||
|
||||
+4
-4
@@ -49,7 +49,7 @@
|
||||
static int frameType;
|
||||
static int frameDot;
|
||||
/* 現在の文字表示位置 */
|
||||
static MyPoint msgcur;
|
||||
static SDL_Point msgcur;
|
||||
static bool nextLineIsAfterKaigyou = false;
|
||||
|
||||
/* Private Methods */
|
||||
@@ -126,7 +126,7 @@ void msg_putMessage(const char *m) {
|
||||
|
||||
ags_setFontWithWeight(nact->ags.font_type, msg.MsgFontSize, nact->ags.font_weight);
|
||||
|
||||
MyRectangle drawn;
|
||||
SDL_Rect drawn;
|
||||
msgcur.x += ags_drawString(msgcur.x, msgcur.y, m, msg.MsgFontColor, &drawn);
|
||||
|
||||
if (nact->messagewait_enable && nact->messagewait_time > 0 &&
|
||||
@@ -265,7 +265,7 @@ void msg_setMessageLocation(int x, int y) {
|
||||
nextLineIsAfterKaigyou = false;
|
||||
}
|
||||
|
||||
void msg_getMessageLocation(MyPoint *loc) {
|
||||
void msg_getMessageLocation(SDL_Point *loc) {
|
||||
loc->x = msgcur.x;
|
||||
loc->y = msgcur.y;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void msg_hitAnyKey() {
|
||||
[UTF8] = "▼",
|
||||
};
|
||||
|
||||
MyRectangle r;
|
||||
SDL_Rect r;
|
||||
int x = msg.win->x + msg.win->width - msg.MsgFontSize;
|
||||
int y = msg.win->y + msg.win->height - msg.MsgFontSize;
|
||||
ags_drawString(x, y, prompt[nact->encoding], msg.HitAnyKeyMsgColor, &r);
|
||||
|
||||
+3
-2
@@ -26,7 +26,8 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "windowframe.h"
|
||||
#include "graphics.h"
|
||||
|
||||
struct SDL_Point;
|
||||
|
||||
extern void msg_init();
|
||||
extern void msg_setFontSize(int size);
|
||||
@@ -36,7 +37,7 @@ extern void msg_nextPage(bool clear);
|
||||
extern void msg_hitAnyKey();
|
||||
extern void msg_openWindow(int W, int C1, int C2, int N, int M);
|
||||
extern void msg_setMessageLocation(int x, int y);
|
||||
extern void msg_getMessageLocation(MyPoint *loc);
|
||||
extern void msg_getMessageLocation(struct SDL_Point *loc);
|
||||
extern void msg_mg6_command(int cmd);
|
||||
|
||||
struct __message {
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define __NACT_H__
|
||||
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
#include "s39ain.h"
|
||||
#include "gameresource.h"
|
||||
#include "selection.h"
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <string.h>
|
||||
#include "portab.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "graphics.h"
|
||||
#include "cg.h"
|
||||
#include "pms.h"
|
||||
|
||||
|
||||
+2
-2
@@ -50,12 +50,12 @@ extern void sdl_setCursorInternalLocation(int x, int y);
|
||||
extern void sdl_setCursorType(int type);
|
||||
extern bool sdl_cursorNew(uint8_t* data, int no, CursorImage *cursorImage, TCursorDirEntry *cursordirentry);
|
||||
extern int sdl_getKeyInfo();
|
||||
extern int sdl_getMouseInfo(MyPoint *p);
|
||||
extern int sdl_getMouseInfo(SDL_Point *p);
|
||||
extern void sdl_getWheelInfo(int *forward, int *back);
|
||||
extern void sdl_clearWheelInfo(void);
|
||||
extern int sdl_getJoyInfo(void);
|
||||
extern void sdl_setAutoRepeat(bool enable);
|
||||
extern MyPoint sdl_translateMouseCoords(int x, int y);
|
||||
extern SDL_Point sdl_translateMouseCoords(int x, int y);
|
||||
|
||||
/* misc */
|
||||
enum messagebox_type {
|
||||
|
||||
+3
-3
@@ -138,7 +138,7 @@ bool sdl_cursorNew(uint8_t* data, int no, CursorImage *cursorImage, TCursorDirEn
|
||||
return true;
|
||||
}
|
||||
|
||||
MyPoint sdl_translateMouseCoords(int x, int y) {
|
||||
SDL_Point sdl_translateMouseCoords(int x, int y) {
|
||||
// scale mouse x and y
|
||||
float scalex, scaley;
|
||||
SDL_RenderGetScale(gfx_renderer, &scalex, &scaley);
|
||||
@@ -163,13 +163,13 @@ MyPoint sdl_translateMouseCoords(int x, int y) {
|
||||
x += border_left;
|
||||
y += border_top;
|
||||
|
||||
MyPoint p = { x, y };
|
||||
SDL_Point p = { x, y };
|
||||
return p;
|
||||
}
|
||||
|
||||
/* マウスの位置の移動 */
|
||||
void sdl_setCursorLocation(int x, int y) {
|
||||
MyPoint t = sdl_translateMouseCoords(x, y);
|
||||
SDL_Point t = sdl_translateMouseCoords(x, y);
|
||||
SDL_WarpMouseInWindow(gfx_window, t.x, t.y);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -519,7 +519,7 @@ int sdl_getKeyInfo() {
|
||||
return rt;
|
||||
}
|
||||
|
||||
int sdl_getMouseInfo(MyPoint *p) {
|
||||
int sdl_getMouseInfo(SDL_Point *p) {
|
||||
sdl_getEvent();
|
||||
|
||||
if (p) {
|
||||
|
||||
+9
-9
@@ -57,12 +57,12 @@ static int regnum;
|
||||
/* 選択肢の要素の最大長さ */
|
||||
static int maxElementLength;
|
||||
/* 選択肢ウィンド退避 */
|
||||
static MyRectangle saveArea;
|
||||
static SDL_Rect saveArea;
|
||||
/* 選択ウィンドの退避用 */
|
||||
static void *saveimg;
|
||||
static void *saveimg2;
|
||||
/* 選択時のワーク */
|
||||
static MyRectangle *workR;
|
||||
static SDL_Rect *workR;
|
||||
/* callback functions 初期化/選択/キャンセル時に呼ばれるシナリオ内関数*/
|
||||
static int cb_select_page;
|
||||
static int cb_select_address;
|
||||
@@ -265,7 +265,7 @@ void sel_fixElement() {
|
||||
/* 選択肢ウィンドを開く為の準備 */
|
||||
static void init_selwindow() {
|
||||
int i;
|
||||
MyRectangle r;
|
||||
SDL_Rect r;
|
||||
|
||||
r.x = sel.win->x;
|
||||
r.y = sel.win->y;
|
||||
@@ -311,7 +311,7 @@ static void init_selwindow() {
|
||||
/* マウスカーソルの自動移動 */
|
||||
int x = r.x + r.w * MOUSE_INIT_X_RATIO/100;
|
||||
if (default_element == 0) {
|
||||
MyPoint p;
|
||||
SDL_Point p;
|
||||
sys_getMouseInfo(&p, true);
|
||||
if (p.y < r.y) {
|
||||
int y = r.y + (sel.MsgFontSize +2) * MOUSE_INIT_Y_RATIO/100;
|
||||
@@ -342,8 +342,8 @@ static void remove_selwindow() {
|
||||
|
||||
static int whereElement(void) {
|
||||
int i;
|
||||
MyPoint p;
|
||||
MyRectangle *r = workR;
|
||||
SDL_Point p;
|
||||
SDL_Rect *r = workR;
|
||||
static int mpx, mpy;
|
||||
|
||||
sys_getMouseInfo(&p, true);
|
||||
@@ -367,7 +367,7 @@ static int whereElement(void) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void lineEncloseElement(MyRectangle *r, int col, bool thick) {
|
||||
static void lineEncloseElement(SDL_Rect *r, int col, bool thick) {
|
||||
ags_drawRectangle(r->x, r->y, r->w + 2, r->h + 2, col);
|
||||
if (thick)
|
||||
ags_drawRectangle(r->x + 1, r->y + 1, r->w, r->h, col);
|
||||
@@ -375,7 +375,7 @@ static void lineEncloseElement(MyRectangle *r, int col, bool thick) {
|
||||
}
|
||||
|
||||
static void encloseElement(int sw, int no) {
|
||||
MyRectangle *r = &workR[no];
|
||||
SDL_Rect *r = &workR[no];
|
||||
|
||||
if (sw == 0) { /* off */
|
||||
if (sel.WinBackgroundTransparent != 255) {
|
||||
@@ -445,7 +445,7 @@ void sel_select() {
|
||||
init_selwindow();
|
||||
|
||||
/* マウス領域の初期化 */
|
||||
if (NULL == (workR = malloc(sizeof(MyRectangle) * regnum))) {
|
||||
if (NULL == (workR = malloc(sizeof(SDL_Rect) * regnum))) {
|
||||
NOMEMERR();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user