Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改 initgraph 的定义,使代码更清晰 #36

Merged
merged 2 commits into from
Aug 11, 2020

Conversation

chirsz-ever
Copy link
Collaborator

不带 Flag 参数仅用长宽调用 initgraph,则在 Release 配置启动时显示 Logo,在 Release 时则不显示。

新增函数 getinitmode

将兼容 BGI 的 initgraph 重载版本的 path 参数类型改为 const char*

不带 Flag 参数仅用长宽调用 `initgraph`,则在 Release 配置启动时显示 Logo,
在 Release 时则不显示。
新增函数 `getinitmode`。
将兼容 BGI 的 `initgraph` 重载版本的 `path` 参数类型改为 `const char*`。
由于初始化顺序不确定等问题,还是禁用比较好
Copy link
Owner

@wysaid wysaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大佬们看看

@@ -339,19 +339,15 @@ enum music_state_flag {
};

enum initmode_flag {
INIT_DEFAULT = 0x0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改了之后跟之前的行为就不一样了... 会不会引起疑问...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可能得在release note 里面单独提一下

src/ege.h Show resolved Hide resolved
@chirsz-ever
Copy link
Collaborator Author

setinitmode 这个 API 所希望的效果:

setinitmode(Flag);
// ...
initgraph(w, h); // 此时实际设置为 Flag

然而 initgraph 实际上有三个参数,第三个参数有默认值,所以之前的实现是只要调用了 setinitmode 则忽略在调用 initgraph 时提供的 Flag 参数。这样的问题是如果你显式调用 initgraph(w, h, NewFlag),其中的 NewFlag 设置不会起效。

修改后当用两个参数调用 initgraph 时行为与原来相同,而用三个参数调用时总是重新设置 Flag 参数。

INIT_DEFAULT 一般只是作为实现之前版本默认参数的 trick,修改它应该不会有问题。

@wysaid wysaid merged commit f7ec076 into wysaid:master Aug 11, 2020
@chirsz-ever chirsz-ever deleted the initgraph-2007 branch August 11, 2020 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants