Merge pull request #6 from Kiritow/pre-merge

Weekly Update
This commit is contained in:
Kirigaya Kazuto 2017-05-02 09:53:42 -05:00 committed by GitHub
commit 9d9ba52d76
12 changed files with 1396 additions and 8 deletions

View File

@ -50,6 +50,72 @@ namespace MiniEngine
return SDL_BLENDMODE_NONE;
}
}
SystemCursorType getCursorTypeFromSDLSystemCursor(SDL_SystemCursor id)
{
switch(id)
{
case SDL_SYSTEM_CURSOR_ARROW:
return SystemCursorType::Arrow;
case SDL_SYSTEM_CURSOR_CROSSHAIR:
return SystemCursorType::CrossHair;
case SDL_SYSTEM_CURSOR_HAND:
return SystemCursorType::Hand;
case SDL_SYSTEM_CURSOR_IBEAM:
return SystemCursorType::Ibeam;
case SDL_SYSTEM_CURSOR_NO:
return SystemCursorType::No;
case SDL_SYSTEM_CURSOR_SIZEALL:
return SystemCursorType::SizeAll;
case SDL_SYSTEM_CURSOR_SIZENESW:
return SystemCursorType::SizeNESW;
case SDL_SYSTEM_CURSOR_SIZENS:
return SystemCursorType::SizeNS;
case SDL_SYSTEM_CURSOR_SIZENWSE:
return SystemCursorType::SizeNWSE;
case SDL_SYSTEM_CURSOR_SIZEWE:
return SystemCursorType::SizeWE;
case SDL_SYSTEM_CURSOR_WAIT:
return SystemCursorType::Wait;
case SDL_SYSTEM_CURSOR_WAITARROW:
return SystemCursorType::WaitArrow;
default:/// return SystemCursorType::Arrow on default.
return SystemCursorType::Arrow;
}
}
SDL_SystemCursor getSDLSystemCursorFromSystemCursorType(SystemCursorType type)
{
switch(type)
{
case SystemCursorType::Arrow:
return SDL_SYSTEM_CURSOR_ARROW;
case SystemCursorType::CrossHair:
return SDL_SYSTEM_CURSOR_CROSSHAIR;
case SystemCursorType::Hand:
return SDL_SYSTEM_CURSOR_HAND;
case SystemCursorType::Ibeam:
return SDL_SYSTEM_CURSOR_IBEAM;
case SystemCursorType::No:
return SDL_SYSTEM_CURSOR_NO;
case SystemCursorType::SizeAll:
return SDL_SYSTEM_CURSOR_SIZEALL;
case SystemCursorType::SizeNESW:
return SDL_SYSTEM_CURSOR_SIZENESW;
case SystemCursorType::SizeNS:
return SDL_SYSTEM_CURSOR_SIZENS;
case SystemCursorType::SizeNWSE:
return SDL_SYSTEM_CURSOR_SIZENWSE;
case SystemCursorType::SizeWE:
return SDL_SYSTEM_CURSOR_SIZEWE;
case SystemCursorType::Wait:
return SDL_SYSTEM_CURSOR_WAIT;
case SystemCursorType::WaitArrow:
return SDL_SYSTEM_CURSOR_WAITARROW;
default:/// return SDL_SYSTEM_CURSOR_ARROW on default.
return SDL_SYSTEM_CURSOR_ARROW;
}
}
}/// End of namespace _internal
Rect::Rect(int X, int Y, int W, int H)
@ -98,7 +164,7 @@ namespace MiniEngine
{
auto p = toSDLPoint();
auto r = rect.toSDLRect();
return SDL_PointInRect(&p, &r);
return ( SDL_PointInRect(&p, &r) == SDL_TRUE );
}
ColorMode::ColorMode(int R, int G, int B)
@ -735,6 +801,74 @@ namespace MiniEngine
return t;
}
//private
void Cursor::_set(SDL_Cursor* p)
{
_cur.reset(p,SDL_FreeCursor);
}
//private
void Cursor::_set_no_delete(SDL_Cursor* p)
{
_cur.reset(p,[](SDL_Cursor* p){});
}
//private
SDL_Cursor* Cursor::_get()
{
return _cur.get();
}
//static
Cursor Cursor::CreateCursor(Surface surf,Point hotspot)
{
Cursor ns;
SDL_Cursor* cursor=SDL_CreateColorCursor(surf._get(),hotspot.x,hotspot.y);
ns._set(cursor);
return ns;
}
//static
Cursor Cursor::CreateSystemCursor(SystemCursorType type)
{
Cursor ns;
ns._set(SDL_CreateSystemCursor(_internal::getSDLSystemCursorFromSystemCursorType(type)));
return ns;
}
//static
Cursor Cursor::GetActiveCursor()
{
Cursor ns;
ns._set(SDL_GetCursor());
return ns;
}
//static
Cursor Cursor::GetDefaultCursor()
{
Cursor ns;
ns._set(SDL_GetDefaultCursor());
return ns;
}
//static
bool Cursor::isShow()
{
return (SDL_ShowCursor(SDL_QUERY)==SDL_ENABLE);
}
//static
void Cursor::show(bool Settings)
{
SDL_ShowCursor(Settings?SDL_ENABLE:SDL_DISABLE);
}
void Cursor::activate()
{
SDL_SetCursor(_get());
}
bool Renderer::isReady()
{
return (_get() != nullptr);
@ -829,6 +963,16 @@ namespace MiniEngine
return std::string(SDL_GetWindowTitle(_get()));
}
void Window::setGrab(bool isGrab)
{
SDL_SetWindowGrab(_get(),isGrab?SDL_TRUE:SDL_FALSE);
}
bool Window::getGrab()
{
return (SDL_GetWindowGrab(_get())==SDL_TRUE)?true:false;
}
void Window::setResizable(bool resizable)
{
//SDL_SetWindowResizable(_get(), resizable?SDL_TRUE:SDL_FALSE);
@ -1438,12 +1582,12 @@ namespace MiniEngine
bool MusicPlayer::isPlaying()
{
return Mix_PlayingMusic();
return (Mix_PlayingMusic() == 1);
}
bool MusicPlayer::isPaused()
{
return Mix_PausedMusic();
return (Mix_PausedMusic() == 1);
}
int MusicPlayer::isFading()

View File

@ -7,6 +7,9 @@
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_mixer.h>
/// VC++ does not implied C++ exception. Use this to ignore compile warning on this.
#pragma warning (disable:4290)
#else
/// CodeBlocks (MinGW Compiler)
#include <SDL2/SDL.h>
@ -20,8 +23,7 @@
#include <memory>
#include <functional>
#define _DECL_DEPRECATED __declspec(deprecated)
#define _DECL_DEPRECATED_MSG(InfoString) __declspec(deprecated(InfoString))
#define _DECL_DEPRECATED [[deprecated]]
namespace MiniEngine
{
@ -150,6 +152,7 @@ namespace MiniEngine
friend class Window;
friend class Renderer;
friend class Font;
friend class Cursor;
};
class Texture
@ -232,6 +235,35 @@ namespace MiniEngine
friend class Window;
};
enum class SystemCursorType
{
Arrow, Ibeam, CrossHair,
Wait, WaitArrow,
SizeNWSE, SizeNESW, SizeWE, SizeNS, SizeAll,
No, Hand
};
class Cursor
{
public:
static Cursor CreateSystemCursor(SystemCursorType);
static Cursor CreateCursor(Surface surf,Point hotspot={0,0});
static Cursor GetActiveCursor();
static Cursor GetDefaultCursor();
static void show(bool);
static bool isShow();
void activate();
private:
std::shared_ptr<SDL_Cursor> _cur;
void _set(SDL_Cursor*);
void _set_no_delete(SDL_Cursor*);
SDL_Cursor* _get();
void _clear();
};
enum class MessageBoxType { Error, Warning, Information };
class Window
@ -268,6 +300,9 @@ namespace MiniEngine
void setTitle(std::string Title);
std::string getTitle();
void setGrab(bool);
bool getGrab();
void setResizable(bool resizable);
/// Use UTF8 in Title and Message please.

View File

@ -1 +1,251 @@
#include "MiniEngine_Event.h"
int PollEvent(Event& refEvent)
{
return SDL_PollEvent(&refEvent);
}
int WaitEvent(Event& refEvent)
{
return SDL_WaitEvent(&refEvent);
}
int WaitEventTimeout(Event& refEvent,int ms)
{
return SDL_WaitEventTimeout(&refEvent,ms);
}
int PushEvent(const Event& refEvent)
{
return SDL_PushEvent(const_cast<Event*>(&refEvent));
}
bool operator == (const LooperID& a,const LooperID& b)
{
return a._type_id==b._type_id && a._looper_cnt==b._looper_cnt ;
}
Looper::Looper()
{
_update=_running=true;
_loop_cnt=0;
updater=[](){};
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<int(Looper&,Event&)>& event_callback)
{
_evmap[event_type].push_front(std::make_pair(_loop_cnt,event_callback));
return _getNextID(event_type);
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<int(Event&)>& event_callback)
{
_evmap[event_type].push_front(std::make_pair(_loop_cnt,[=](Looper& lp,Event& ev)->int{return event_callback(ev);}));
return _getNextID(event_type);
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<int(Looper&)>& event_callback)
{
_evmap[event_type].push_front(std::make_pair(_loop_cnt,[=](Looper& lp,Event& ev)->int{return event_callback(lp);}));
return _getNextID(event_type);
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<int()>& event_callback)
{
_evmap[event_type].push_front(std::make_pair(_loop_cnt,[=](Looper& lp,Event& ev)->int{return event_callback();}));
return _getNextID(event_type);
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<void(Looper&,Event&)>& event_callback)
{
return add(event_type,std::function<int(Looper&,Event&)>([=](Looper& lp,Event& ev)->int{event_callback(lp,ev); return 0;}));
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<void(Event&)>& event_callback)
{
return add(event_type,std::function<int(Looper&,Event&)>([=](Looper& lp,Event& ev)->int{event_callback(ev); return 0;}));
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<void(Looper&)>& event_callback)
{
return add(event_type,std::function<int(Looper&,Event&)>([=](Looper& lp,Event& ev)->int{event_callback(lp); return 0;}));
}
LooperID Looper::add(_SDLEventType_ event_type,const std::function<void()>& event_callback)
{
return add(event_type,std::function<int(Looper&,Event&)>([=](Looper& lp,Event& ev)->int{event_callback();return 0;}));
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<int(Looper&,Event&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<int(Event&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<int(Looper&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<int()>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<void(Looper&,Event&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<void(Event&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<void(Looper&)>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
LooperID Looper::operator + (const std::pair<_SDLEventType_,std::function<void()>>& event_callback)
{
return add(event_callback.first,event_callback.second);
}
bool Looper::remove(const LooperID& looperid)
{
for(auto beginIter=_evmap[looperid._type_id].begin(),
endIter=_evmap[looperid._type_id].end(),
iter=beginIter;
iter!=endIter;
++iter)
{
if(iter->first==looperid._looper_cnt)
{
_evmap[looperid._type_id].erase(iter);
return true;
}
}
return false;
}
bool Looper::operator -(const LooperID& looperid)
{
return remove(looperid);
}
void Looper::dispatch()
{
for(auto callbackPack:_evmap[_e.type])
{
if(callbackPack.second(*this,_e)) break;
}
}
void Looper::run()
{
while(_running)
{
while(!_update&&WaitEvent(_e))
{
dispatch();
}
updater();
_update=false;
}
}
Event Looper::GetLastEvent()
{
return _e;
}
void Looper::needupdate()
{
_update=true;
}
void Looper::needstop()
{
_running=false;
}
void Looper::stop()
{
needstop();
needupdate();
}
void Looper::reset()
{
_running=true;
_update=true;
_evmap.clear();
_loop_cnt=0;
updater=[](){};
}
LooperID Looper::_getNextID(const _SDLEventType_& event_type)
{
LooperID id;
id._looper_cnt = _loop_cnt;
id._type_id = event_type;
++_loop_cnt;
return id;
}
Poller::Poller()
{
idler=[](){};
}
void Poller::reset()
{
Looper::reset();
idler=[](){};
}
void Poller::run()
{
int pollret=1;
while(_running)
{
while(!_update&&(pollret=PollEvent(_e)))
{
dispatch();
}
/// If pollret is not 0 (new event requests update), or pollret is 0 (No New Event) but Idle function requests update, then call updater.
if(!pollret) idler();
if(_update)
{
updater();
_update=false;
}
}
}
LooperWithTime::LooperWithTime(int Timeout_ms)
{
_timeout_ms = Timeout_ms;
}
void LooperWithTime::setTimeout(int ms)
{
_timeout_ms = ms;
}
int LooperWithTime::getTimeout() const
{
return _timeout_ms;
}
void LooperWithTime::run()
{
int timeret = 1;
while (_running)
{
while (!_update&&(timeret=WaitEventTimeout(_e, _timeout_ms)))
{
dispatch();
}
/// If timeret is not 0 (new event request update), or timeret is 0 (Time out) but Idle function requests update, then call updater.
if (!timeret) idler();
if (_update)
{
updater();
_update = false;
}
}
}

View File

@ -1,2 +1,89 @@
#pragma once
#include "MiniEngine.h"
#include <map>
#include <list>
typedef SDL_Event Event;
int PollEvent(Event& refEvent);
int WaitEvent(Event& refEvent);
int WaitEventTimeout(Event& refEvent,int ms);
int PushEvent(const Event& refEvent);
typedef struct
{
decltype(Event::type) _type_id;
int _looper_cnt;
}LooperID;
bool operator == (const LooperID&,const LooperID&);
class Looper
{
public:
typedef decltype(Event::type) _SDLEventType_;
Looper();
/// If Callback does not return 0, then stop transferring this event.
LooperID add(_SDLEventType_ event_type,const std::function<int(Looper&,Event&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<int(Event&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<int(Looper&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<int()>& event_callback);
/// If Callback has no return (void), then we assume it returns 0.
LooperID add(_SDLEventType_ event_type,const std::function<void(Looper&,Event&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<void(Event&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<void(Looper&)>& event_callback);
LooperID add(_SDLEventType_ event_type,const std::function<void()>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<int(Looper&,Event&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<int(Event&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<int(Looper&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<int()>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<void(Looper&,Event&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<void(Event&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<void(Looper&)>>& event_callback);
LooperID operator + (const std::pair<_SDLEventType_,std::function<void()>>& event_callback);
bool remove(const LooperID& looperid);
bool operator - (const LooperID& looperid);
void dispatch();
void run();
Event GetLastEvent();
void needupdate();
void needstop();
void stop();
void reset();
std::function<void()> updater;
protected:
LooperID _getNextID(const _SDLEventType_ & event_type);
Event _e;
bool _running,_update;
std::map<_SDLEventType_,std::list<std::pair<int,std::function<int(Looper&,Event&)>>>> _evmap;
int _loop_cnt;
};
class Poller : public Looper
{
public:
Poller();
void run();
void reset();
std::function<void()> idler;
};
class LooperWithTime : public Poller
{
public:
LooperWithTime(int Timeout_ms=10);
void setTimeout(int ms);
int getTimeout() const;
void run();
protected:
int _timeout_ms;
};

View File

@ -81,7 +81,7 @@ int SQLDB::exec(const std::string& SQLCommand)
return _exec_real(SQLCommand,nullptr,nullptr);
}
int SQLDB::exec(const std::string& SQLCommand,SQLCallback callback,void* param)
int SQLDB::exec_raw(const std::string& SQLCommand,SQLCallback callback,void* param)
{
return _exec_real(SQLCommand,callback,param);
}

View File

@ -51,8 +51,7 @@ public:
int exec(const std::string& SQLCommand);
/// Reserved For Capability
int exec(const std::string& SQLCommand,SQLCallback callback,void* param);
int exec_raw(const std::string& SQLCommand,SQLCallback callback,void* param);
const char* getErrorMsg();
void clearError();

391
doc/html/index.html Normal file
View File

@ -0,0 +1,391 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<style>
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
body {
font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
font-size: 14px;
padding: 0 12px;
line-height: 22px;
word-wrap: break-word;
}
#code-csp-warning {
position: fixed;
top: 0;
right: 0;
color: white;
margin: 16px;
text-align: center;
font-size: 12px;
font-family: sans-serif;
background-color:#444444;
cursor: pointer;
padding: 6px;
box-shadow: 1px 1px 1px rgba(0,0,0,.25);
}
#code-csp-warning:hover {
text-decoration: none;
background-color:#007acc;
box-shadow: 2px 2px 2px rgba(0,0,0,.25);
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
body.showEditorSelection .code-line {
position: relative;
}
body.showEditorSelection .code-active-line:before,
body.showEditorSelection .code-line:hover:before {
content: "";
display: block;
position: absolute;
top: 0;
left: -12px;
height: 100%;
}
body.showEditorSelection li.code-active-line:before,
body.showEditorSelection li.code-line:hover:before {
left: -30px;
}
.vscode-light.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(0, 0, 0, 0.15);
}
.vscode-light.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(0, 0, 0, 0.40);
}
.vscode-dark.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(255, 255, 255, 0.4);
}
.vscode-dark.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(255, 255, 255, 0.60);
}
.vscode-high-contrast.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(255, 160, 0, 0.7);
}
.vscode-high-contrast.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(255, 160, 0, 1);
}
img {
max-width: 100%;
max-height: 100%;
}
a {
color: #4080D0;
text-decoration: none;
}
a:focus,
input:focus,
select:focus,
textarea:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
}
hr {
border: 0;
height: 2px;
border-bottom: 2px solid;
}
h1 {
padding-bottom: 0.3em;
line-height: 1.2;
border-bottom-width: 1px;
border-bottom-style: solid;
}
h1, h2, h3 {
font-weight: normal;
}
h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
font-size: inherit;
line-height: auto;
}
a:hover {
color: #4080D0;
text-decoration: underline;
}
table {
border-collapse: collapse;
}
table > thead > tr > th {
text-align: left;
border-bottom: 1px solid;
}
table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td {
padding: 5px 10px;
}
table > tbody > tr + tr > td {
border-top: 1px solid;
}
blockquote {
margin: 0 7px 0 5px;
padding: 0 16px 0 10px;
border-left: 5px solid;
}
code {
font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
font-size: 14px;
line-height: 19px;
}
body.wordWrap pre {
white-space: pre-wrap;
}
.mac code {
font-size: 12px;
line-height: 18px;
}
pre:not(.hljs),
pre.hljs code > div {
padding: 16px;
border-radius: 3px;
overflow: auto;
}
/** Theming */
.vscode-light,
.vscode-light pre code {
color: rgb(30, 30, 30);
}
.vscode-dark,
.vscode-dark pre code {
color: #DDD;
}
.vscode-high-contrast,
.vscode-high-contrast pre code {
color: white;
}
.vscode-light code {
color: #A31515;
}
.vscode-dark code {
color: #D7BA7D;
}
.vscode-light pre:not(.hljs),
.vscode-light code > div {
background-color: rgba(220, 220, 220, 0.4);
}
.vscode-dark pre:not(.hljs),
.vscode-dark code > div {
background-color: rgba(10, 10, 10, 0.4);
}
.vscode-high-contrast pre:not(.hljs),
.vscode-high-contrast code > div {
background-color: rgb(0, 0, 0);
}
.vscode-high-contrast h1 {
border-color: rgb(0, 0, 0);
}
.vscode-light table > thead > tr > th {
border-color: rgba(0, 0, 0, 0.69);
}
.vscode-dark table > thead > tr > th {
border-color: rgba(255, 255, 255, 0.69);
}
.vscode-light h1,
.vscode-light hr,
.vscode-light table > tbody > tr + tr > td {
border-color: rgba(0, 0, 0, 0.18);
}
.vscode-dark h1,
.vscode-dark hr,
.vscode-dark table > tbody > tr + tr > td {
border-color: rgba(255, 255, 255, 0.18);
}
.vscode-light blockquote,
.vscode-dark blockquote {
background: rgba(127, 127, 127, 0.1);
border-color: rgba(0, 122, 204, 0.5);
}
.vscode-high-contrast blockquote {
background: transparent;
border-color: #fff;
}
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #8e908c;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #c82829;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #f5871f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #eab700;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #718c00;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #4271ae;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #8959a8;
}
.hljs {
display: block;
overflow-x: auto;
color: #4d4d4c;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
body
{
background-color: white;
}
.emoji
{
height: 20px;
}
</style>
</head>
<body>
<article class="vscode-light markdown-body">
<h1 id="miniengine">MiniEngine 帮助</h1>
<h2 id="">简介</h2>
<h2 id="-2">应用到项目中</h2>
<h2 id="miniengine-2">MiniEngine核心部分</h2>
<h3 id="-3">类列表</h3>
<p>Rect
Point
ColorMode
RGBA
NonCopyable
ErrorViewer
RWOP
Surface
Texture
Renderer
Cursor
Window
Font
LogSystem
SDLSystem
Timer
AudioPlayer
Music
MusicPlayer
Sound
SoundPlayer
StringEngine</p>
<h3 id="-4">枚举列表</h3>
<p>BlendMode
RendererType
FlipMode
SystemCursorType
Platform
PowerState</p>
<h3 id="-5">全局函数列表</h3>
<p>UTF8ToGBK
GBKToUTF8
canread
canwrite
isexist
canexecute
GetArgc
GetArgv</p>
</article>
</body>
</html>

391
doc/html/rect.html Normal file
View File

@ -0,0 +1,391 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<style>
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
body {
font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
font-size: 14px;
padding: 0 12px;
line-height: 22px;
word-wrap: break-word;
}
#code-csp-warning {
position: fixed;
top: 0;
right: 0;
color: white;
margin: 16px;
text-align: center;
font-size: 12px;
font-family: sans-serif;
background-color:#444444;
cursor: pointer;
padding: 6px;
box-shadow: 1px 1px 1px rgba(0,0,0,.25);
}
#code-csp-warning:hover {
text-decoration: none;
background-color:#007acc;
box-shadow: 2px 2px 2px rgba(0,0,0,.25);
}
body.scrollBeyondLastLine {
margin-bottom: calc(100vh - 22px);
}
body.showEditorSelection .code-line {
position: relative;
}
body.showEditorSelection .code-active-line:before,
body.showEditorSelection .code-line:hover:before {
content: "";
display: block;
position: absolute;
top: 0;
left: -12px;
height: 100%;
}
body.showEditorSelection li.code-active-line:before,
body.showEditorSelection li.code-line:hover:before {
left: -30px;
}
.vscode-light.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(0, 0, 0, 0.15);
}
.vscode-light.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(0, 0, 0, 0.40);
}
.vscode-dark.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(255, 255, 255, 0.4);
}
.vscode-dark.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(255, 255, 255, 0.60);
}
.vscode-high-contrast.showEditorSelection .code-active-line:before {
border-left: 3px solid rgba(255, 160, 0, 0.7);
}
.vscode-high-contrast.showEditorSelection .code-line:hover:before {
border-left: 3px solid rgba(255, 160, 0, 1);
}
img {
max-width: 100%;
max-height: 100%;
}
a {
color: #4080D0;
text-decoration: none;
}
a:focus,
input:focus,
select:focus,
textarea:focus {
outline: 1px solid -webkit-focus-ring-color;
outline-offset: -1px;
}
hr {
border: 0;
height: 2px;
border-bottom: 2px solid;
}
h1 {
padding-bottom: 0.3em;
line-height: 1.2;
border-bottom-width: 1px;
border-bottom-style: solid;
}
h1, h2, h3 {
font-weight: normal;
}
h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
font-size: inherit;
line-height: auto;
}
a:hover {
color: #4080D0;
text-decoration: underline;
}
table {
border-collapse: collapse;
}
table > thead > tr > th {
text-align: left;
border-bottom: 1px solid;
}
table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td {
padding: 5px 10px;
}
table > tbody > tr + tr > td {
border-top: 1px solid;
}
blockquote {
margin: 0 7px 0 5px;
padding: 0 16px 0 10px;
border-left: 5px solid;
}
code {
font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
font-size: 14px;
line-height: 19px;
}
body.wordWrap pre {
white-space: pre-wrap;
}
.mac code {
font-size: 12px;
line-height: 18px;
}
pre:not(.hljs),
pre.hljs code > div {
padding: 16px;
border-radius: 3px;
overflow: auto;
}
/** Theming */
.vscode-light,
.vscode-light pre code {
color: rgb(30, 30, 30);
}
.vscode-dark,
.vscode-dark pre code {
color: #DDD;
}
.vscode-high-contrast,
.vscode-high-contrast pre code {
color: white;
}
.vscode-light code {
color: #A31515;
}
.vscode-dark code {
color: #D7BA7D;
}
.vscode-light pre:not(.hljs),
.vscode-light code > div {
background-color: rgba(220, 220, 220, 0.4);
}
.vscode-dark pre:not(.hljs),
.vscode-dark code > div {
background-color: rgba(10, 10, 10, 0.4);
}
.vscode-high-contrast pre:not(.hljs),
.vscode-high-contrast code > div {
background-color: rgb(0, 0, 0);
}
.vscode-high-contrast h1 {
border-color: rgb(0, 0, 0);
}
.vscode-light table > thead > tr > th {
border-color: rgba(0, 0, 0, 0.69);
}
.vscode-dark table > thead > tr > th {
border-color: rgba(255, 255, 255, 0.69);
}
.vscode-light h1,
.vscode-light hr,
.vscode-light table > tbody > tr + tr > td {
border-color: rgba(0, 0, 0, 0.18);
}
.vscode-dark h1,
.vscode-dark hr,
.vscode-dark table > tbody > tr + tr > td {
border-color: rgba(255, 255, 255, 0.18);
}
.vscode-light blockquote,
.vscode-dark blockquote {
background: rgba(127, 127, 127, 0.1);
border-color: rgba(0, 122, 204, 0.5);
}
.vscode-high-contrast blockquote {
background: transparent;
border-color: #fff;
}
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
color: #8e908c;
}
/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
color: #c82829;
}
/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
color: #f5871f;
}
/* Tomorrow Yellow */
.hljs-attribute {
color: #eab700;
}
/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
color: #718c00;
}
/* Tomorrow Blue */
.hljs-title,
.hljs-section {
color: #4271ae;
}
/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #8959a8;
}
.hljs {
display: block;
overflow-x: auto;
color: #4d4d4c;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
body
{
background-color: white;
}
.emoji
{
height: 20px;
}
</style>
</head>
<body>
<article class="vscode-light markdown-body">
<h1 id="rect">Rect 矩形类</h1>
<h2 id="">成员</h2>
<table>
<thead>
<tr>
<th>类型</th>
<th>名称</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>int</td>
<td>x</td>
<td>矩形左上角的x坐标</td>
</tr>
<tr>
<td>int</td>
<td>y</td>
<td>矩形左上角的y坐标</td>
</tr>
<tr>
<td>int</td>
<td>w</td>
<td>矩形宽度</td>
</tr>
<tr>
<td>int</td>
<td>h</td>
<td>矩形高度</td>
</tr>
</tbody>
</table>
<h2 id="-2">方法</h2>
<p>Rect()</p>
<blockquote></blockquote>
<p>默认构造.长宽为0且坐标为(0,0)</p>
<p>Rect(int X,int Y,int W,int H)</p>
<blockquote></blockquote>
<p>指定参数的构造</p>
<p>SDL_Rect Rect::toSDLRect()</p>
<blockquote></blockquote>
<p>将当前矩形转换为SDL_Rect表示</p>
</article>
</body>
</html>

43
doc/markdown/index.md Normal file
View File

@ -0,0 +1,43 @@
# MiniEngine 帮助
## 简介
## 应用到项目中
## MiniEngine核心部分
### 类列表
[Rect](rect.md)
Point
ColorMode
RGBA
NonCopyable
ErrorViewer
RWOP
Surface
Texture
Renderer
Cursor
Window
Font
LogSystem
SDLSystem
Timer
AudioPlayer
Music
MusicPlayer
Sound
SoundPlayer
StringEngine
### 枚举列表
BlendMode
RendererType
FlipMode
SystemCursorType
Platform
PowerState
### 全局函数列表
UTF8ToGBK
GBKToUTF8
canread
canwrite
isexist
canexecute
GetArgc
GetArgv

20
doc/markdown/rect.md Normal file
View File

@ -0,0 +1,20 @@
# Rect 矩形类
## 成员
| 类型 | 名称 | 描述 |
| --- | --- | --- |
| int | x | 矩形左上角的x坐标 |
| int | y | 矩形左上角的y坐标 |
| int | w | 矩形宽度 |
| int | h | 矩形高度 |
## 方法
Rect()
>
默认构造.长宽为0且坐标为(0,0)
Rect(int X,int Y,int W,int H)
>
指定参数的构造
SDL_Rect Rect::toSDLRect()
>
将当前矩形转换为SDL_Rect表示

14
makefile_c4 Normal file
View File

@ -0,0 +1,14 @@
CXXFLAGS = -std=c++14 -Wall -O2 -D__C4DROID__ -Iinclude
LDFLAGS =
LDLIBS = -lSDL2_image -lSDL2_net -ltiff -ljpeg -lpng -lz -lSDL2_ttf -lfreetype -lSDL2_mixer -lSDL2_test -lsmpeg2 -lvorbisfile -lvorbis -logg -lstdc++ -lSDL2 -lEGL -lGLESv1_CM -lGLESv2 -landroid -Wl,--no-undefined -shared
PROG = program_name
OBJS = MiniEngine.o MiniEngine_Android.o MiniEngine_Event.o MiniEngine_Widget.o sqlite/sqlite3.o MiniEngine_SQLite.o
all: $(PROG)
$(PROG): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $(OBJS) `sdl2-config --cflags --libs`
clean:
rm -f $(PROG) $(OBJS)

14
makefile_linux Normal file
View File

@ -0,0 +1,14 @@
CXXFLAGS = -std=c++14 -Wall -O2 -D__LINUX__ -Iinclude
LDFLAGS =
LDLIBS = -lstdc++ -lSDL2_image -lSDL2_net -lSDL2_ttf -lSDL2_mixer -lSDL2_test -lSDL2 -shared
PROG = program_name
OBJS = MiniEngine.o MiniEngine_Android.o MiniEngine_Event.o MiniEngine_Widget.o sqlite/sqlite3.o MiniEngine_SQLite.o
all: $(PROG)
$(PROG): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ $(OBJS) `sdl2-config --cflags --libs`
clean:
rm -f $(PROG) $(OBJS)