Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
673cbb1e
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
673cbb1e
编写于
3月 12, 2015
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unused code from cave_main
上级
0cd5465f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
98 deletion
+23
-98
tests/caveview/cave_main.c
tests/caveview/cave_main.c
+23
-98
未找到文件。
tests/caveview/cave_main.c
浏览文件 @
673cbb1e
#define _WIN32_WINNT 0x400
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
//#include "game.h"
#include <windows.h>
#define STB_GL_IMPLEMENTATION
#define STB_GLEXT_DEFINE "glext_list.h"
#include "stb_gl.h"
// stb.h
#define STB_DEFINE
#include "stb.h"
#include "caveview.h"
// stb_gl.h
#define STB_GL_IMPLEMENTATION
#define STB_GLEXT_DEFINE "glext_list.h"
#include "stb_gl.h"
// SDL
#include "sdl.h"
#include "SDL_opengl.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
// stb_glprog.h
#define STB_GLPROG_IMPLEMENTATION
#define STB_GLPROG_ARB_DEFINE_EXTENSIONS
#include "stb_glprog.h"
// stb_image.h
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
// stb_easy_font.h
#include "stb_easy_font.h" // doesn't require an IMPLEMENTATION
#include "caveview.h"
char
*
game_name
=
"caveview"
;
// assume only a single texture with all sprites
float
texture_s_scale
;
float
texture_t_scale
;
GLuint
interface_tex
,
logo_tex
;
extern
int
screen_x
,
screen_y
;
// main.c
#define REVERSE_DEPTH
void
print_string
(
float
x
,
float
y
,
char
*
text
,
float
r
,
float
g
,
float
b
)
static
void
print_string
(
float
x
,
float
y
,
char
*
text
,
float
r
,
float
g
,
float
b
)
{
static
char
buffer
[
99999
];
int
num_quads
;
...
...
@@ -55,11 +51,11 @@ void print_string(float x, float y, char *text, float r, float g, float b)
glDisableClientState
(
GL_VERTEX_ARRAY
);
}
float
text_color
[
3
];
float
pos_x
=
10
;
float
pos_y
=
10
;
static
float
text_color
[
3
];
static
float
pos_x
=
10
;
static
float
pos_y
=
10
;
void
print
(
char
*
text
,
...)
static
void
print
(
char
*
text
,
...)
{
char
buffer
[
999
];
va_list
va
;
...
...
@@ -70,24 +66,10 @@ void print(char *text, ...)
pos_y
+=
10
;
}
// mouse offsetting 'pixel to virtual'
float
xs_p2v
,
ys_p2v
;
// xoff_p2v, yoff_p2v;
// viewport offseting 'virtual to pixel'
float
xs_v2p
,
ys_v2p
,
xoff_v2p
,
yoff_v2p
;
float
camang
[
3
],
camloc
[
3
]
=
{
0
,
0
,
75
};
float
player_zoom
=
1
.
0
;
int
third_person
;
float
rotate_view
=
0
.
0
;
#define REVERSE_DEPTH
void
init_game
(
void
)
{
// init_graphics();
}
void
camera_to_worldspace
(
float
world
[
3
],
float
cam_x
,
float
cam_y
,
float
cam_z
)
{
...
...
@@ -293,23 +275,8 @@ void draw_main(void)
glLoadIdentity
();
stbgl_initCamera_zup_facing_y
();
//glTranslatef(0,150,-5);
// position the camera and render it
if
(
third_person
)
{
glTranslatef
(
0
,
2
.
5
,
0
);
glRotatef
(
-
camang
[
0
],
1
,
0
,
0
);
glTranslatef
(
0
,
2
,
0
);
glRotatef
(
-
camang
[
2
]
-
rotate_view
,
0
,
0
,
1
);
//glTranslatef(0,0,1);
//glTranslatef(0,0,-1);
}
else
{
glRotatef
(
-
camang
[
0
],
1
,
0
,
0
);
glRotatef
(
-
camang
[
2
],
0
,
0
,
1
);
}
glRotatef
(
-
camang
[
0
],
1
,
0
,
0
);
glRotatef
(
-
camang
[
2
],
0
,
0
,
1
);
glTranslatef
(
-
camloc
[
0
],
-
camloc
[
1
],
-
camloc
[
2
]);
start_time
=
SDL_GetPerformanceCounter
();
...
...
@@ -355,7 +322,6 @@ void ods(char *fmt, ...)
static
SDL_Window
*
window
;
extern
void
init_game
(
void
);
extern
void
draw_main
(
void
);
extern
void
process_tick
(
float
dt
);
extern
void
editor_init
(
void
);
...
...
@@ -377,17 +343,11 @@ float carried_dt = 0;
int
raw_level_time
;
extern
void
init_game
(
void
);
extern
void
draw_main
(
void
);
float
global_timer
;
int
loopmode
(
float
dt
,
int
real
,
int
in_client
)
{
float
actual_dt
=
dt
;
float
jump_timer
=
dt
;
if
(
!
initialized
)
return
0
;
if
(
!
real
)
...
...
@@ -413,10 +373,6 @@ int loopmode(float dt, int real, int in_client)
static
int
quit
;
//int winproc(void *data, stbwingraph_event *e)
extern
int
editor_scale
;
extern
void
editor_key
(
enum
stbte_action
act
);
extern
int
controls
;
void
active_control_set
(
int
key
)
...
...
@@ -444,8 +400,6 @@ void process_event(SDL_Event *e)
break
;
case
SDL_MOUSEBUTTONDOWN
:
case
SDL_MOUSEBUTTONUP
:
case
SDL_MOUSEWHEEL
:
//stbte_mouse_sdl(edit_map, e, 1.0f/editor_scale,1.0f/editor_scale,0,0);
break
;
case
SDL_QUIT
:
...
...
@@ -462,36 +416,13 @@ void process_event(SDL_Event *e)
}
break
;
case
SDL_TEXTINPUT
:
switch
(
e
->
text
.
text
[
0
])
{
#if 0
case 27: {
#if 0
int result;
SDL_ShowCursor(SDL_ENABLE);
if (MessageBox(e->handle, "Exit CLTT?", "CLTT", MB_OKCANCEL) == IDOK);
#endif
{
quit = 1;
break;
}
//SDL_ShowCursor(SDL_DISABLE);
break;
}
#endif
}
break
;
case
SDL_KEYDOWN
:
{
int
k
=
e
->
key
.
keysym
.
sym
;
int
s
=
e
->
key
.
keysym
.
scancode
;
SDL_Keymod
mod
;
mod
=
SDL_GetModState
();
if
(
k
==
SDLK_ESCAPE
)
{
#ifndef DO_EDITOR
if
(
k
==
SDLK_ESCAPE
)
quit
=
1
;
#endif
}
if
(
s
==
SDL_SCANCODE_D
)
active_control_set
(
0
);
if
(
s
==
SDL_SCANCODE_A
)
active_control_set
(
1
);
...
...
@@ -573,10 +504,6 @@ static float getTimestep(float minimum_time)
void
APIENTRY
gl_debug
(
GLenum
source
,
GLenum
type
,
GLuint
id
,
GLenum
severity
,
GLsizei
length
,
const
GLchar
*
message
,
const
void
*
param
)
{
#if 0
if (severity == GL_DEBUG_SEVERITY_LOW_ARB)
return;
#endif
ods
(
"%s
\n
"
,
message
);
}
...
...
@@ -643,7 +570,6 @@ int SDL_main(int argc, char **argv)
mesh_init
();
world_init
();
init_game
();
initialized
=
1
;
while
(
!
quit
)
{
...
...
@@ -652,7 +578,6 @@ int SDL_main(int argc, char **argv)
process_event
(
&
e
);
loopmode
(
getTimestep
(
0
.
0166
f
/
8
),
1
,
1
);
quit
=
quit
;
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录