mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Split sdl_core.h to event.h and editor.h
And rename sdl_event.c to event.c, sdl_input.c to editor.c.
This commit is contained in:
+2
-2
@@ -60,6 +60,7 @@ target_sources(xsystem35 PRIVATE
|
||||
dri.c
|
||||
ecopy.c
|
||||
effect.c
|
||||
event.c
|
||||
filecheck.c
|
||||
font.c
|
||||
hacks.c
|
||||
@@ -86,7 +87,6 @@ target_sources(xsystem35 PRIVATE
|
||||
savedata.c
|
||||
scenario.c
|
||||
scheduler.c
|
||||
sdl_event.c
|
||||
selection.c
|
||||
system.c
|
||||
texthook.c
|
||||
@@ -125,7 +125,7 @@ elseif (ANDROID)
|
||||
elseif (ENABLE_GTK)
|
||||
target_sources(xsystem35 PRIVATE menu.c menu_callback.c menu_gui.c s39init.c)
|
||||
else ()
|
||||
target_sources(xsystem35 PRIVATE menu_sdl.c sdl_input.c)
|
||||
target_sources(xsystem35 PRIVATE menu_sdl.c editor.c)
|
||||
endif()
|
||||
|
||||
if (HAVE_WEBP)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "ags.h"
|
||||
#include "gfx.h"
|
||||
#include "effect.h"
|
||||
#include "sdl_core.h"
|
||||
#include "event.h"
|
||||
#include "alpha_plane.h"
|
||||
#include "utfsjis.h"
|
||||
#include "input.h"
|
||||
@@ -142,6 +142,7 @@ void ags_init(const char *render_driver, bool enable_zb) {
|
||||
nact->ags.font_weight = enable_zb ? FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL;
|
||||
|
||||
gfx_Initialize(render_driver);
|
||||
event_init();
|
||||
cursor_init();
|
||||
font_init();
|
||||
|
||||
@@ -151,6 +152,7 @@ void ags_init(const char *render_driver, bool enable_zb) {
|
||||
|
||||
void ags_remove(void) {
|
||||
ags_autorepeat(true);
|
||||
event_remove();
|
||||
gfx_Remove();
|
||||
}
|
||||
|
||||
@@ -723,7 +725,7 @@ void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
|
||||
// We can't move the actual cursor in the browser, but can change the
|
||||
// internal mouse coordinates. This can help with keyboard/gamepad
|
||||
// navigation.
|
||||
sdl_setCursorInternalLocation(x, y);
|
||||
event_set_mouse_internal_location(x, y);
|
||||
EM_ASM({ xsystem35.shell.showMouseMoveEffect($0, $1); }, x, y);
|
||||
sys_sleep(cursor_move_time);
|
||||
}
|
||||
@@ -736,12 +738,12 @@ void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
|
||||
for (int i = 1; i < 8; i++) {
|
||||
int xi = ((dx*i*i*i) >> 9) - ((3*dx*i*i)>> 6) + ((3*dx*i) >> 3) + p.x;
|
||||
int yi = ((dy*i*i*i) >> 9) - ((3*dy*i*i)>> 6) + ((3*dy*i) >> 3) + p.y;
|
||||
sdl_setCursorLocation(xi, yi);
|
||||
event_set_mouse_location(xi, yi);
|
||||
sys_sleep(cursor_move_time / 7);
|
||||
}
|
||||
sdl_setCursorLocation(x, y);
|
||||
event_set_mouse_location(x, y);
|
||||
} else if (!for_selection) {
|
||||
sdl_setCursorInternalLocation(x, y);
|
||||
event_set_mouse_internal_location(x, y);
|
||||
sys_sleep(cursor_move_time);
|
||||
}
|
||||
#endif
|
||||
@@ -782,7 +784,11 @@ surface_t *ags_getDIB() {
|
||||
}
|
||||
|
||||
void ags_autorepeat(bool enable) {
|
||||
sdl_setAutoRepeat(enable);
|
||||
if (enable) {
|
||||
// SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
} else {
|
||||
// SDL_EnableKeyRepeat(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool ags_clipCopyRect(const SDL_Rect *sw, const SDL_Rect *dw, int *sx, int *sy, int *dx, int *dy, int *w, int *h) {
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ unsigned Y3waitFlags = KEYWAIT_CANCELABLE;
|
||||
* delay, when a button is pressed.
|
||||
*
|
||||
* For Rance4 v2, this does not work because the UI loop also checks keyboard
|
||||
* status, so we use a different hack. See rance4v2_hack() in sdl_event.c.
|
||||
* status, so we use a different hack. See rance4v2_hack() in event.c.
|
||||
*/
|
||||
static void rance4_Y3_IM_hack() {
|
||||
static int count;
|
||||
|
||||
+5
-5
@@ -32,7 +32,7 @@
|
||||
#include "debug_symbol.h"
|
||||
#include "msgqueue.h"
|
||||
#include "gfx.h"
|
||||
#include "sdl_core.h"
|
||||
#include "event.h"
|
||||
#include "system.h"
|
||||
#include "nact.h"
|
||||
#include "variable.h"
|
||||
@@ -594,13 +594,13 @@ static int read_command_thread(void *data) {
|
||||
free(buf);
|
||||
break;
|
||||
}
|
||||
sdl_post_debugger_command(buf);
|
||||
event_post_debugger_command(buf);
|
||||
content_length = -1;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown Debug Adapter Protocol header: %s", header);
|
||||
}
|
||||
}
|
||||
sdl_post_debugger_command(NULL); // end of messages
|
||||
event_post_debugger_command(NULL); // end of messages
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ static void dbg_dap_init(const char *path) {
|
||||
while (!initialized && !nact->is_quit) {
|
||||
SDL_Event e;
|
||||
SDL_WaitEvent(&e);
|
||||
sdl_handle_event(&e);
|
||||
event_handle_event(&e);
|
||||
while (!msgq_isempty(queue)) {
|
||||
char *msg = msgq_dequeue(queue);
|
||||
if (!msg)
|
||||
@@ -640,7 +640,7 @@ static void dbg_dap_repl(int bp_no) {
|
||||
while (continue_repl && !nact->is_quit) {
|
||||
SDL_Event e;
|
||||
SDL_WaitEvent(&e);
|
||||
sdl_handle_event(&e);
|
||||
event_handle_event(&e);
|
||||
while (!msgq_isempty(queue)) {
|
||||
char *msg = msgq_dequeue(queue);
|
||||
if (!msg)
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "sdl_core.h"
|
||||
#include "editor.h"
|
||||
#include "event.h"
|
||||
#include "gfx.h"
|
||||
#include "gfx_private.h"
|
||||
#include "menu.h"
|
||||
#include "nact.h"
|
||||
#include "system.h"
|
||||
@@ -131,7 +131,7 @@ static bool handle_event(const SDL_Event *e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool sdl_inputString(INPUTSTRING_PARAM *p) {
|
||||
bool edit_string(INPUTSTRING_PARAM *p) {
|
||||
static char *buf;
|
||||
free(buf);
|
||||
buf = malloc(p->max * MAX_UTF8_BYTES_PAR_CHAR + 1);
|
||||
@@ -155,14 +155,14 @@ bool sdl_inputString(INPUTSTRING_PARAM *p) {
|
||||
ags_setFont(FONT_GOTHIC, p->h);
|
||||
redraw();
|
||||
|
||||
sdl_custom_event_handler = handle_event;
|
||||
event_custom_handler = handle_event;
|
||||
while (!input->done) {
|
||||
sdl_getKeyInfo(); // message pump
|
||||
event_get_key(); // message pump
|
||||
nact->callback();
|
||||
sys_wait_vsync();
|
||||
}
|
||||
SDL_StopTextInput();
|
||||
sdl_custom_event_handler = NULL;
|
||||
event_custom_handler = NULL;
|
||||
|
||||
ags_restoreRegion(saved_region, s.rect.x, s.rect.y);
|
||||
ags_updateArea(s.rect.x, s.rect.y, s.rect.w, s.rect.h);
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2025 kichikuou <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef __EDITOR_H__
|
||||
#define __EDITOR_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct inputstring_param;
|
||||
|
||||
bool edit_string(struct inputstring_param *);
|
||||
|
||||
#endif // __EDITOR_H__
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* sdl_darw.c SDL event handler
|
||||
*
|
||||
* Copyright (C) 2000- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,7 +16,6 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: sdl_event.c,v 1.5 2001/12/16 17:12:56 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@@ -31,12 +28,12 @@
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "event.h"
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "debugger.h"
|
||||
#include "nact.h"
|
||||
#include "gfx.h"
|
||||
#include "sdl_core.h"
|
||||
#include "gfx_private.h"
|
||||
#include "scheduler.h"
|
||||
#include "menu.h"
|
||||
@@ -44,9 +41,11 @@
|
||||
#include "msgskip.h"
|
||||
#include "hacks.h"
|
||||
|
||||
static void sdl_getEvent(void);
|
||||
static void get_event(void);
|
||||
static void keyEventProsess(SDL_KeyboardEvent *e, bool pressed);
|
||||
|
||||
bool (*event_custom_handler)(const SDL_Event *);
|
||||
|
||||
static uint32_t custom_event_type = (uint32_t)-1;
|
||||
|
||||
enum CustomEventCode {
|
||||
@@ -62,7 +61,7 @@ bool RawKeyInfo[256];
|
||||
/* SDL Joystick */
|
||||
static int joyinfo=0;
|
||||
|
||||
static int sdl_keytable[SDL_NUM_SCANCODES] = {
|
||||
static int keytable[SDL_NUM_SCANCODES] = {
|
||||
[SDL_SCANCODE_A] = KEY_A,
|
||||
[SDL_SCANCODE_B] = KEY_B,
|
||||
[SDL_SCANCODE_C] = KEY_C,
|
||||
@@ -187,7 +186,7 @@ static int sdl_keytable[SDL_NUM_SCANCODES] = {
|
||||
static int joy_device_index = -1;
|
||||
static SDL_Joystick *js;
|
||||
|
||||
static bool sdl_joy_open(int index) {
|
||||
static bool joy_open(int index) {
|
||||
if (js)
|
||||
return false;
|
||||
|
||||
@@ -203,33 +202,33 @@ static bool sdl_joy_open(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool joy_open(void) {
|
||||
static bool joy_init(void) {
|
||||
SDL_Init(SDL_INIT_JOYSTICK);
|
||||
|
||||
if (joy_device_index >= 0)
|
||||
return sdl_joy_open(joy_device_index);
|
||||
return joy_open(joy_device_index);
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++) {
|
||||
if (sdl_joy_open(i))
|
||||
if (joy_open(i))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void sdl_event_init(void) {
|
||||
void event_init(void) {
|
||||
if (custom_event_type == (uint32_t)-1)
|
||||
custom_event_type = SDL_RegisterEvents(1);
|
||||
joy_open();
|
||||
joy_init();
|
||||
}
|
||||
|
||||
void sdl_event_remove(void) {
|
||||
void event_remove(void) {
|
||||
if (js) {
|
||||
SDL_JoystickClose(js);
|
||||
js = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void sdl_setJoyDeviceIndex(int index) {
|
||||
void event_set_joy_device_index(int index) {
|
||||
joy_device_index = index;
|
||||
}
|
||||
|
||||
@@ -277,7 +276,7 @@ void send_agsevent(enum agsevent_type type, int code) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void sdl_setCursorLocation(int x, int y) {
|
||||
void event_set_mouse_location(int x, int y) {
|
||||
// scale mouse x and y
|
||||
float scalex, scaley;
|
||||
SDL_RenderGetScale(gfx_renderer, &scalex, &scaley);
|
||||
@@ -304,7 +303,7 @@ void sdl_setCursorLocation(int x, int y) {
|
||||
SDL_WarpMouseInWindow(gfx_window, x, y);
|
||||
}
|
||||
|
||||
void sdl_setCursorInternalLocation(int x, int y) {
|
||||
void event_set_mouse_internal_location(int x, int y) {
|
||||
mousex = x;
|
||||
mousey = y;
|
||||
send_agsevent(AGSEVENT_MOUSE_MOTION, 0);
|
||||
@@ -353,8 +352,8 @@ static void rance4v2_hack(void) {
|
||||
cancel_yield();
|
||||
}
|
||||
|
||||
void sdl_handle_event(SDL_Event *e) {
|
||||
if (sdl_custom_event_handler && sdl_custom_event_handler(e))
|
||||
void event_handle_event(SDL_Event *e) {
|
||||
if (event_custom_handler && event_custom_handler(e))
|
||||
return;
|
||||
|
||||
switch (e->type) {
|
||||
@@ -397,7 +396,7 @@ void sdl_handle_event(SDL_Event *e) {
|
||||
#endif
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
sdl_setCursorInternalLocation(e->motion.x, e->motion.y);
|
||||
event_set_mouse_internal_location(e->motion.x, e->motion.y);
|
||||
#ifdef _WIN32
|
||||
win_menu_onMouseMotion(e->motion.x, e->motion.y);
|
||||
#endif
|
||||
@@ -472,7 +471,7 @@ void sdl_handle_event(SDL_Event *e) {
|
||||
break;
|
||||
|
||||
case SDL_JOYDEVICEADDED:
|
||||
sdl_joy_open(e->jdevice.which);
|
||||
joy_open(e->jdevice.which);
|
||||
break;
|
||||
|
||||
case SDL_JOYAXISMOTION:
|
||||
@@ -551,7 +550,7 @@ void sdl_handle_event(SDL_Event *e) {
|
||||
}
|
||||
|
||||
/* Event処理 */
|
||||
static void sdl_getEvent(void) {
|
||||
static void get_event(void) {
|
||||
enum scheduler_event scheduler_event = SCHEDULER_EVENT_INPUT_CHECK_MISS;
|
||||
|
||||
fire_deferred_touch_event();
|
||||
@@ -559,7 +558,7 @@ static void sdl_getEvent(void) {
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
scheduler_event = SCHEDULER_EVENT_INPUT_CHECK_HIT;
|
||||
sdl_handle_event(&e);
|
||||
event_handle_event(&e);
|
||||
}
|
||||
scheduler_on_event(scheduler_event);
|
||||
if (game_id == GAME_RANCE4_V2)
|
||||
@@ -568,15 +567,15 @@ static void sdl_getEvent(void) {
|
||||
|
||||
/* キー情報の取得 */
|
||||
static void keyEventProsess(SDL_KeyboardEvent *e, bool pressed) {
|
||||
int code = sdl_keytable[e->keysym.scancode];
|
||||
int code = keytable[e->keysym.scancode];
|
||||
RawKeyInfo[code] = pressed;
|
||||
send_agsevent(pressed ? AGSEVENT_KEY_PRESS : AGSEVENT_KEY_RELEASE, code);
|
||||
}
|
||||
|
||||
int sdl_getKeyInfo() {
|
||||
int event_get_key(void) {
|
||||
int rt;
|
||||
|
||||
sdl_getEvent();
|
||||
get_event();
|
||||
|
||||
rt = ((RawKeyInfo[KEY_UP] || RawKeyInfo[KEY_PAD_8]) |
|
||||
((RawKeyInfo[KEY_DOWN] || RawKeyInfo[KEY_PAD_2]) << 1) |
|
||||
@@ -590,8 +589,8 @@ int sdl_getKeyInfo() {
|
||||
return rt;
|
||||
}
|
||||
|
||||
int sdl_getMouseInfo(SDL_Point *p) {
|
||||
sdl_getEvent();
|
||||
int event_get_mouse(SDL_Point *p) {
|
||||
get_event();
|
||||
|
||||
if (p) {
|
||||
p->x = mousex;
|
||||
@@ -603,7 +602,7 @@ int sdl_getMouseInfo(SDL_Point *p) {
|
||||
return m1 | m2;
|
||||
}
|
||||
|
||||
void sdl_getWheelInfo(int *forward, int *back) {
|
||||
void event_get_wheel(int *forward, int *back) {
|
||||
*forward = mouse_wheel_up;
|
||||
*back = mouse_wheel_down;
|
||||
|
||||
@@ -612,16 +611,16 @@ void sdl_getWheelInfo(int *forward, int *back) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void sdl_clearWheelInfo(void) {
|
||||
void event_clear_wheel(void) {
|
||||
mouse_wheel_up = mouse_wheel_down = 0;
|
||||
}
|
||||
|
||||
int sdl_getJoyInfo(void) {
|
||||
sdl_getEvent();
|
||||
int event_get_joy(void) {
|
||||
get_event();
|
||||
return joyinfo;
|
||||
}
|
||||
|
||||
void sdl_post_debugger_command(void *data) {
|
||||
void event_post_debugger_command(void *data) {
|
||||
SDL_Event event = {
|
||||
.user = {
|
||||
.type = custom_event_type,
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* sdl_core.h SDL acess wrapper
|
||||
*
|
||||
* Copyright (C) 2000- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -18,34 +16,27 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: sdl_core.h,v 1.18 2003/01/04 17:01:02 chikama Exp $ */
|
||||
|
||||
#ifndef __SDL_CORE__
|
||||
#define __SDL_CORE__
|
||||
#ifndef __EVENT_H__
|
||||
#define __EVENT_H__
|
||||
|
||||
#include "config.h"
|
||||
#include <sys/types.h>
|
||||
#include <SDL_events.h>
|
||||
#include "portab.h"
|
||||
|
||||
struct inputstring_param;
|
||||
extern bool (*event_custom_handler)(const SDL_Event *);
|
||||
|
||||
/* key/pointer 関係 */
|
||||
extern void sdl_setJoyDeviceIndex(int index);
|
||||
extern void sdl_setCursorLocation(int x, int y);
|
||||
extern void sdl_setCursorInternalLocation(int x, int y);
|
||||
extern int sdl_getKeyInfo();
|
||||
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);
|
||||
void event_init(void);
|
||||
void event_remove(void);
|
||||
void event_set_joy_device_index(int index);
|
||||
void event_set_mouse_location(int x, int y);
|
||||
void event_set_mouse_internal_location(int x, int y);
|
||||
int event_get_key(void);
|
||||
int event_get_mouse(SDL_Point *p);
|
||||
void event_get_wheel(int *forward, int *back);
|
||||
void event_clear_wheel(void);
|
||||
int event_get_joy(void);
|
||||
void event_post_debugger_command(void *data);
|
||||
void event_handle_event(SDL_Event *e);
|
||||
|
||||
/* misc */
|
||||
extern bool sdl_inputString(struct inputstring_param *);
|
||||
extern void sdl_post_debugger_command(void *data);
|
||||
extern void sdl_handle_event(SDL_Event *e);
|
||||
|
||||
extern bool save_screenshot(const char* path);
|
||||
|
||||
#endif /* !__SDL_CORE__ */
|
||||
#endif // __EVENT_H__
|
||||
@@ -78,4 +78,6 @@ void gfx_delRegion(void *src);
|
||||
void gfx_FlipSurfaceHorizontal(SDL_Surface *s);
|
||||
void gfx_FlipSurfaceVertical(SDL_Surface *s);
|
||||
|
||||
bool save_screenshot(const char* path);
|
||||
|
||||
#endif /* __GFX_H__ */
|
||||
|
||||
@@ -39,10 +39,7 @@ extern int view_w;
|
||||
extern int view_h;
|
||||
extern bool gfx_dirty;
|
||||
extern bool gfx_fullscreen;
|
||||
extern bool (*sdl_custom_event_handler)(const SDL_Event *);
|
||||
|
||||
void sdl_event_init(void);
|
||||
void sdl_event_remove(void);
|
||||
int gfx_nearest_color(int r, int g, int b);
|
||||
SDL_Surface *gfx_dib_to_surface_with_alpha(int x, int y, int w, int h);
|
||||
SDL_Surface *gfx_dib_to_surface_colorkey(int x, int y, int w, int h, int col);
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "system.h"
|
||||
#include "gfx.h"
|
||||
#include "gfx_private.h"
|
||||
#include "sdl_core.h"
|
||||
#include "xsystem35.h"
|
||||
#include "image.h"
|
||||
|
||||
@@ -47,7 +46,6 @@ int view_w;
|
||||
int view_h;
|
||||
bool gfx_dirty;
|
||||
bool gfx_fullscreen;
|
||||
bool (*sdl_custom_event_handler)(const SDL_Event *);
|
||||
|
||||
static void window_init(const char *render_driver);
|
||||
static void makeDIB(int width, int height, int depth);
|
||||
@@ -59,8 +57,6 @@ int gfx_Initialize(const char *render_driver) {
|
||||
/* offscreen Pixmap */
|
||||
makeDIB(SYS35_DEFAULT_WIDTH, SYS35_DEFAULT_HEIGHT, SYS35_DEFAULT_DEPTH);
|
||||
|
||||
sdl_event_init();
|
||||
|
||||
gfx_setWindowSize(SYS35_DEFAULT_WIDTH, SYS35_DEFAULT_HEIGHT);
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
@@ -78,7 +74,6 @@ void gfx_Remove(void) {
|
||||
SDL_FreeSurface(main_surface);
|
||||
if (gfx_renderer)
|
||||
SDL_DestroyRenderer(gfx_renderer);
|
||||
sdl_event_remove();
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
@@ -200,15 +195,6 @@ SDL_Surface *gfx_createSurfaceView(SDL_Surface *sf, int x, int y, int w, int h)
|
||||
return view;
|
||||
}
|
||||
|
||||
/* AutoRepeat の設定 */
|
||||
void sdl_setAutoRepeat(bool enable) {
|
||||
if (enable) {
|
||||
// SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
} else {
|
||||
// SDL_EnableKeyRepeat(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_setFullscreen(bool on) {
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if (on == gfx_fullscreen)
|
||||
|
||||
+7
-7
@@ -25,7 +25,7 @@
|
||||
#include <limits.h>
|
||||
#include "config.h"
|
||||
#include "input.h"
|
||||
#include "sdl_core.h"
|
||||
#include "event.h"
|
||||
#include "scheduler.h"
|
||||
#include "xsystem35.h"
|
||||
#include "message.h"
|
||||
@@ -53,7 +53,7 @@ void set_hak_keymode(int key, int mode) {
|
||||
|
||||
int sys_getMouseInfo(SDL_Point *p, bool is_dibgeo) {
|
||||
SDL_Point _p;
|
||||
int key = sdl_getMouseInfo(&_p);
|
||||
int key = event_get_mouse(&_p);
|
||||
|
||||
if (p) {
|
||||
p->x = _p.x;
|
||||
@@ -67,23 +67,23 @@ int sys_getMouseInfo(SDL_Point *p, bool is_dibgeo) {
|
||||
}
|
||||
|
||||
void sys_getWheelInfo(int *forward, int *back) {
|
||||
sdl_getWheelInfo(forward, back);
|
||||
event_get_wheel(forward, back);
|
||||
}
|
||||
|
||||
void sys_clearWheelInfo(void) {
|
||||
sdl_clearWheelInfo();
|
||||
event_clear_wheel();
|
||||
}
|
||||
|
||||
int sys_getKeyInfo() {
|
||||
return sdl_getKeyInfo();
|
||||
return event_get_key();
|
||||
}
|
||||
|
||||
int sys_getJoyInfo() {
|
||||
return sdl_getJoyInfo();
|
||||
return event_get_joy();
|
||||
}
|
||||
|
||||
int sys_getInputInfo() {
|
||||
return sdl_getMouseInfo(NULL) | sdl_getKeyInfo() | sdl_getJoyInfo();
|
||||
return event_get_mouse(NULL) | event_get_key() | event_get_joy();
|
||||
}
|
||||
|
||||
int sys_keywait(int msec, unsigned flags) {
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@
|
||||
#include "system.h"
|
||||
#include "nact.h"
|
||||
#include "menu.h"
|
||||
#include "sdl_core.h"
|
||||
#include "editor.h"
|
||||
#include "gfx_private.h"
|
||||
#ifdef _WIN32
|
||||
#include "win/dialog.h"
|
||||
@@ -93,7 +93,7 @@ bool menu_inputstring(INPUTSTRING_PARAM *p) {
|
||||
}
|
||||
|
||||
bool menu_inputstring2(INPUTSTRING_PARAM *p) {
|
||||
return sdl_inputString(p);
|
||||
return edit_string(p);
|
||||
}
|
||||
|
||||
bool menu_inputnumber(INPUTNUM_PARAM *p) {
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gfx.h"
|
||||
#include "gfx_private.h"
|
||||
#include "scheduler.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <android/log.h>
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "system.h"
|
||||
#include "menu.h"
|
||||
#include "nact.h"
|
||||
#include "sdl_core.h"
|
||||
#include "gfx.h"
|
||||
#include "gfx_private.h"
|
||||
#include "resources.h"
|
||||
|
||||
+3
-3
@@ -57,7 +57,7 @@
|
||||
#include "ags.h"
|
||||
#include "font.h"
|
||||
#include "gfx.h"
|
||||
#include "sdl_core.h"
|
||||
#include "event.h"
|
||||
#include "menu.h"
|
||||
#include "music.h"
|
||||
#include "music_cdrom.h"
|
||||
@@ -262,7 +262,7 @@ static void sys35_ParseOption(int *argc, char **argv) {
|
||||
midi_set_output_device(argv[i][2] | subdev);
|
||||
} else if (0 == strcmp(argv[i], "-devjoy")) {
|
||||
if (argv[i + 1] != NULL) {
|
||||
sdl_setJoyDeviceIndex(atoi(argv[i + 1]));
|
||||
event_set_joy_device_index(atoi(argv[i + 1]));
|
||||
}
|
||||
} else if (0 == strcmp(argv[i], "-fullscreen")) {
|
||||
fs_on = true;
|
||||
@@ -360,7 +360,7 @@ static void check_profile() {
|
||||
/* joystick device name の設定 */
|
||||
param = get_profile("joy_device");
|
||||
if (param) {
|
||||
sdl_setJoyDeviceIndex(atoi(param));
|
||||
event_set_joy_device_index(atoi(param));
|
||||
}
|
||||
/* MIDI output device の設定 */
|
||||
param = get_profile("midi_output_device");
|
||||
|
||||
Reference in New Issue
Block a user