Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Insarudo
project
Commits
985eff62
There was a problem fetching the pipeline summary.
Commit
985eff62
authored
8 years ago
by
Jin Zijun
Browse files
Options
Downloads
Patches
Plain Diff
change the platted mode
parent
76ac8b5f
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/game.h
+59
-51
59 additions, 51 deletions
src/game.h
with
59 additions
and
51 deletions
src/game.h
+
59
−
51
View file @
985eff62
#include
<stdlib.h>
#include
<stdio.h>
#include
<stdint.h>
#include
<string.h>
#include
<SDL2/SDL.h>
#include
<SDL2/SDL_image.h>
#include
<SDL2/SDL_ttf.h>
/*
typedef union SDL_Event
{
Uint8
type
;
//事件类型
SDL_ActiveEvent
active
;
//窗口焦点、输入焦点及鼠标焦点的失去和得到事件
SDL_KeyboardEvent
key
;
//键盘事件,键盘按下和释放
SDL_MouseMotionEvent
motion
;
//鼠标移动事件
SDL_MouseButtonEvent
button
;
//鼠标按键事件
SDL_QuitEvent
quit
;
//退出事件
SDL_SysWMEvent
syswm
;
//平台相关的系统事件
}
SDL_Event
;
typedef
enum
{
SDL_NOEVENT
=
0
,
/* 未使用 */
SDL_ACTIVEEVENT
,
/* 应用程序失去焦点或得到焦点*/
SDL_KEYDOWN
,
/* 按下某键 */
SDL_KEYUP
,
/* 松开某键 */
SDL_MOUSEMOTION
,
/* 鼠标移动 */
SDL_MOUSEBUTTONDOWN
,
/* 鼠标键按下 */
SDL_MOUSEBUTTONUP
,
/* 鼠标键松开 */
SDL_QUIT
,
/*离开 */
SDL_SYSWMEVENT
,
/* 系统事件 */
SDL_EVENT_RESERVEDA
,
/* 保留 */
SDL_EVENT_RESERVEDB
,
/* 保留 */
SDL_VIDEORESIZE
,
/* 用户改变视频模式 */
SDL_VIDEOEXPOSE
,
/* 屏幕重画 */
SDL_EVENT_RESERVED2
,
/* 保留*/
SDL_EVENT_RESERVED3
,
/* 保留 */
SDL_EVENT_RESERVED4
,
/* 保留 */
SDL_EVENT_RESERVED5
,
/* 保留 */
SDL_EVENT_RESERVED6
,
/* 保留*/
SDL_EVENT_RESERVED7
,
/* 保留 */
SDL_USEREVENT
=
24
,
/* 用户自定义事件 */
SDL_NUMEVENTS
=
32
}
SDL_EventType
;
typedef
struct
SDL_MouseButtonEvent
{
Uint8
type
;
/* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
Uint8
which
;
/* The mouse device index */
Uint8
button
;
/* 鼠标按键,左、右、中三个键*/
Uint8
state
;
/* SDL_PRESSED按下 or SDL_RELEASED松开 */
Uint16
x
,
y
;
/* 鼠标按下时的坐标 */
}
SDL_MouseButtonEvent
;
typedef
struct
SDL_MouseMotionEvent
{
Uint8
type
;
/* SDL_MOUSEMOTION */
Uint8
which
;
/* The mouse device index */
Uint8
state
;
/* 鼠标状态 */
Uint16
x
,
y
;
/* 鼠标当前坐标 */
Sint16
xrel
;
/* 鼠标在x方向的位移 */
Sint16
yrel
;
/* 鼠标在y方向的位移*/
}
SDL_MouseMotionEvent
;
Uint8 type; //事件类型
SDL_ActiveEvent active; //窗口焦点、输入焦点及鼠标焦点的失去和得到事件
SDL_KeyboardEvent key; //键盘事件,键盘按下和释放
SDL_MouseMotionEvent motion; //鼠标移动事件
SDL_MouseButtonEvent button; //鼠标按键事件
SDL_QuitEvent quit; //退出事件
SDL_SysWMEvent syswm; //平台相关的系统事件
}SDL_Event;*/
//typedef enum
//{
//SDL_NOEVENT = 0, /* 未使用 */
//SDL_ACTIVEEVENT, /* 应用程序失去焦点或得到焦点*/
//SDL_KEYDOWN, /* 按下某键 */
//SDL_KEYUP, /* 松开某键 */
//SDL_MOUSEMOTION, /* 鼠标移动 */
//SDL_MOUSEBUTTONDOWN, /* 鼠标键按下 */
//SDL_MOUSEBUTTONUP, /* 鼠标键松开 */
//SDL_QUIT, /*离开 */
//SDL_SYSWMEVENT, /* 系统事件 */
//SDL_EVENT_RESERVEDA, /* 保留 */
//SDL_EVENT_RESERVEDB, /* 保留 */
//SDL_VIDEORESIZE, /* 用户改变视频模式 */
//SDL_VIDEOEXPOSE, /* 屏幕重画 */
//SDL_EVENT_RESERVED2, /* 保留*/
//SDL_EVENT_RESERVED3, /* 保留 */
//SDL_EVENT_RESERVED4, /* 保留 */
//SDL_EVENT_RESERVED5, /* 保留 */
//SDL_EVENT_RESERVED6, /* 保留*/
//SDL_EVENT_RESERVED7, /* 保留 */
//SDL_USEREVENT = 24, /* 用户自定义事件 */
//SDL_NUMEVENTS = 32
//}SDL_EventType;
//typedef struct SDL_MouseButtonEvent
//{
// Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
// Uint8 which; /* The mouse device index */
// Uint8 button; /* 鼠标按键,左、右、中三个键*/
// Uint8 state; /* SDL_PRESSED按下 or SDL_RELEASED松开 */
// Uint16 x, y; /* 鼠标按下时的坐标 */
//}SDL_MouseButtonEvent;
//typedef struct SDL_MouseMotionEvent
//{
// Uint8 type; /* SDL_MOUSEMOTION */
// Uint8 which; /* The mouse device index */
// Uint8 state; /* 鼠标状态 */
// Uint16 x, y; /* 鼠标当前坐标 */
// Sint16 xrel; /* 鼠标在x方向的位移 */
// Sint16 yrel; /* 鼠标在y方向的位移*/
//} SDL_MouseMotionEvent;
typedef
enum
{
LEFT
,
RIGHT
}
BUTTONPOS
;
//枚举按钮在精灵图中的编号
typedef
enum
{
un
,
deux
,
OTHER
}
BUTTONFLAG
;
//枚举按钮
#ifndef FONT_H
#define FONT_H
...
...
@@ -99,6 +106,7 @@ extern const SDL_Color RGB_Noname;
int
isOnButton
(
int
aX
,
int
aY
,
int
aIndex
);
void
changeButton
(
BUTTONPOS
aPos
,
int
aNo
,
SDL_Rect
*
aDst
);
BOOL
init
(
char
*
aCaption
,
char
*
aIcon
);
SDL_Surface
*
loadImage
(
char
*
filename
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment