summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-02-24 12:37:12 +0800
committerchai <chaifix@163.com>2020-02-24 12:37:12 +0800
commit87b9482459c1a27b8756514473ae392453db39ec (patch)
treeb47b5130f4a346adeaf26cde9787f43ab6949e57 /src
parent538cb1cd010a3323ad61239a12a4134ef4dceca6 (diff)
*window
Diffstat (limited to 'src')
-rw-r--r--src/extend/camera.c6
-rw-r--r--src/extern/wog.c2
-rw-r--r--src/extern/wog.h2
-rw-r--r--src/main.c18
4 files changed, 14 insertions, 14 deletions
diff --git a/src/extend/camera.c b/src/extend/camera.c
index f349006..e580b79 100644
--- a/src/extend/camera.c
+++ b/src/extend/camera.c
@@ -13,7 +13,7 @@ void camera_init(Camera* cam, wog_Window* wnd) {
cam->near = 1;
cam->far = 5500;
- cam->aspect = 600/500.f;
+ cam->aspect = 600/480.f;
cam->fov = 60;
cam->zoom_speed = 4000;
@@ -22,7 +22,7 @@ void camera_init(Camera* cam, wog_Window* wnd) {
cam->rotate_sensitivity.x = 5;
cam->rotate_sensitivity.y = 5;
cam->move_sensitivity.x = 150;
- cam->move_sensitivity.y = 100;
+ cam->move_sensitivity.y = 150;
cam->euler.yaw = cam->euler.pitch = cam->euler.roll = 0;
cam->wnd = wnd;
@@ -71,7 +71,7 @@ static void _onlookaround(Camera* cam,float dt) {
float dx = cam->mouse_prev.x - x, dy = y - cam->mouse_prev.y;
angle.x = dy * cam->rotate_sensitivity.y * dt;
angle.y = dx * cam->rotate_sensitivity.x * dt;
- cam->euler.pitch += angle.x;
+ cam->euler.pitch -= angle.x;
cam->euler.yaw += angle.y;
//printf("%f %f\n", cam->euler.pitch, cam->euler.yaw);
quat_fromeuler(&cam->euler, &cam->transform.localrotation);
diff --git a/src/extern/wog.c b/src/extern/wog.c
index 28d4dd1..04a84c7 100644
--- a/src/extern/wog.c
+++ b/src/extern/wog.c
@@ -352,7 +352,7 @@ wog_Window* wog_createWindow(const char* title, int width, int height, int x, in
windowStyle |= WS_CAPTION;
windowStyle |= WS_SYSMENU;
windowStyle |= WS_MINIMIZEBOX;
- windowStyle |= WS_VISIBLE;
+ //windowStyle |= WS_VISIBLE;
#define hasbit(fs, f) ((fs & f) == f)
if (hasbit(flags, WOG_RESIZABLE)) windowStyle |= WS_SIZEBOX;
if (hasbit(flags, WOG_DISABLE)) windowStyle |= WS_DISABLED;
diff --git a/src/extern/wog.h b/src/extern/wog.h
index ba11556..0b2540e 100644
--- a/src/extern/wog.h
+++ b/src/extern/wog.h
@@ -1,5 +1,5 @@
/**
-* Copyright (c) 2015~2017 chai(neonum)
+* Copyright (c) 2015~2017 chai
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MIT license. See LICENSE for details.
diff --git a/src/main.c b/src/main.c
index edc31bb..292d663 100644
--- a/src/main.c
+++ b/src/main.c
@@ -8,28 +8,27 @@
#include "extend/camera.h"
#define SCREEN_WIDTH 600
-#define SCREEN_HEIGHT 500
+#define SCREEN_HEIGHT 480
typedef void(*F)(void*);
+
F onload;
F onupdate;
F onevent;
F ondraw;
-/*macro这里需要绕一下弯*/
/*https://stackoverflow.com/questions/1489932/how-to-concatenate-twice-with-the-c-preprocessor-and-expand-a-macro-as-in-arg*/
#define SETEXAMPLEF(f, e) \
-f = f##_##e;
+ f = f##_##e;
#define SETEXAMPLE(i) \
-SETEXAMPLEF(onload, i)\
-SETEXAMPLEF(ondraw, i)\
-SETEXAMPLEF(onevent, i)\
-SETEXAMPLEF(onupdate, i)
+ SETEXAMPLEF(onload, i)\
+ SETEXAMPLEF(ondraw, i)\
+ SETEXAMPLEF(onevent, i)\
+ SETEXAMPLEF(onupdate, i)
int main(int argc, char* argv[]) {
- wog_Window* wnd = wog_createWindow("Soft Shader Room", SCREEN_WIDTH, SCREEN_HEIGHT, 500, 500, 0);
- wog_show(wnd);
+ wog_Window* wnd = wog_createWindow("Soft Shade Room", SCREEN_WIDTH, SCREEN_HEIGHT, 500, 500, 0);
wog_Surface* surface = wog_getsurface(wnd); // ARGB format
/* init ssr */
ssr_Config config = {
@@ -40,6 +39,7 @@ int main(int argc, char* argv[]) {
ssr_init(&config);
SETEXAMPLE(EXAMPLECUR);
onload(NULL);
+ wog_show(wnd);
/*set up global camera*/
Camera cam;
camera_init(&cam, wnd);