Remove stray #pragma once lines, update PGE emscripten build so it handles mouse scrolling proper. Add emscripten run script. Build 3146.

This commit is contained in:
sigonasr2 2023-11-27 00:01:19 -06:00
parent 3f9543d93b
commit cfd5586d63
16 changed files with 16 additions and 19 deletions

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"

View File

@ -1110,7 +1110,7 @@ void Crawler::RenderWorld(float fElapsedTime){
if(dn->lifeTime<=1){ if(dn->lifeTime<=1){
if(dn->lifeTime<DamageNumber::MOVE_UP_TIME){ if(dn->lifeTime<DamageNumber::MOVE_UP_TIME){
if(dn->invertedDirection){ if(dn->invertedDirection){
dn->pos.y+=20*fElapsedTime; dn->pos.y+=40*fElapsedTime;
}else{ }else{
dn->pos.y-=20*fElapsedTime; dn->pos.y-=20*fElapsedTime;
} }
@ -2129,7 +2129,9 @@ void Crawler::SetLoadoutItem(int slot,std::string itemName){
switch(slot){ switch(slot){
case 0:{ case 0:{
itemAbility.action=[&](Player*p,vf2d pos={}){ itemAbility.action=[&](Player*p,vf2d pos={}){
return game->UseLoadoutItem(0); bool itemUsed=game->UseLoadoutItem(0);
return itemUsed;
}; };
game->GetPlayer()->SetItem1UseFunc(itemAbility); game->GetPlayer()->SetItem1UseFunc(itemAbility);
}break; }break;

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "olcPixelGameEngine.h" #include "olcPixelGameEngine.h"
#include "safemap.h" #include "safemap.h"

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"

View File

@ -58,11 +58,6 @@ enum MenuType{
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
}; };
template<typename T>
T*Component(MenuType menu,std::string componentName){
return (T*)Menu::menus[menu]->components[componentName];
}
class Menu:public IAttributable{ class Menu:public IAttributable{
friend class Crawler; friend class Crawler;
friend class Player; friend class Player;
@ -146,6 +141,11 @@ private:
static bool cover; //A black cover for when a menu pops up to fade out the stuff behind it. static bool cover; //A black cover for when a menu pops up to fade out the stuff behind it.
}; };
template<typename T>
T*Component(MenuType menu,std::string componentName){
return (T*)Menu::menus[menu]->components[componentName];
}
struct MenuFuncData{ struct MenuFuncData{
Menu&menu; Menu&menu;
Crawler*game; Crawler*game;

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"
#include "Menu.h" #include "Menu.h"

View File

@ -31,7 +31,6 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE. SUCH DAMAGE.
*/ */
#pragma endregion #pragma endregion
#pragma once
#include "State_OverworldMap.h" #include "State_OverworldMap.h"
#include "Crawler.h" #include "Crawler.h"
#include "DEFINES.h" #include "DEFINES.h"

View File

@ -35,7 +35,7 @@ SUCH DAMAGE.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 3137 #define VERSION_BUILD 3146
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

View File

@ -0,0 +1,2 @@
~\Documents\emsdk\emsdk_env.ps1 activate latest
emrun play.html

View File

@ -6607,13 +6607,13 @@ namespace olc
// Move // Move
if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE)
{ {
ptrPGE->olc_UpdateMouse(e->touches->targetX-ptrPGE->GetWindowPos().x, e->touches->targetY-ptrPGE->GetWindowPos().y); ptrPGE->olc_UpdateMouse(e->touches->targetX-ptrPGE->GetWindowPos().x-EM_ASM_INT({return window.scrollX}), e->touches->targetY-ptrPGE->GetWindowPos().y-EM_ASM_INT({return window.scrollY}));
} }
// Start // Start
if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART)
{ {
ptrPGE->olc_UpdateMouse(e->touches->targetX-ptrPGE->GetWindowPos().x, e->touches->targetY-ptrPGE->GetWindowPos().y); ptrPGE->olc_UpdateMouse(e->touches->targetX-ptrPGE->GetWindowPos().x-EM_ASM_INT({return window.scrollX}), e->touches->targetY-ptrPGE->GetWindowPos().y-EM_ASM_INT({return window.scrollY}));
ptrPGE->olc_UpdateMouseState(0, true); ptrPGE->olc_UpdateMouseState(0, true);
} }
@ -6631,7 +6631,7 @@ namespace olc
{ {
//Mouse Movement //Mouse Movement
if (eventType == EMSCRIPTEN_EVENT_MOUSEMOVE) if (eventType == EMSCRIPTEN_EVENT_MOUSEMOVE)
ptrPGE->olc_UpdateMouse(e->targetX-ptrPGE->GetWindowPos().x, e->targetY-ptrPGE->GetWindowPos().y); ptrPGE->olc_UpdateMouse(e->targetX-ptrPGE->GetWindowPos().x-EM_ASM_INT({return window.scrollX}), e->targetY-ptrPGE->GetWindowPos().y-EM_ASM_INT({return window.scrollY}));
//Mouse button press //Mouse button press

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 MiB

After

Width:  |  Height:  |  Size: 8.4 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.