Pages: 1 2 3 4 »
  Print  
Author Topic: [Solved] Adding a new function  (Read 9711 times)
Offline (Unknown gender) lonewolff
Posted on: September 28, 2014, 11:00:24 PM
"Guest"


Email
If I were to add the window_device() function to ENIGMA (in the DX9 renderer) what file would I start with?

Just trying to keep the standard as to how you guys like to do things.
« Last Edit: September 29, 2014, 12:31:47 AM by lonewolff » Logged
Offline (Unknown gender) lonewolff
Reply #1 Posted on: September 28, 2014, 11:37:54 PM
"Guest"


Email
Ok, from talking on the IRC the best place for this is DX9Context.h

I have added this but LGM still doesn't know about the window_handle() function.

So, the big question is - If you add a new GML command say 'boo()' (for example) how does ENIGMA know what this new function belongs to in the source code. Or is just having the function name 'boo' in the source code enough?
Logged
Offline (Unknown gender) sorlok_reaves
Reply #2 Posted on: September 28, 2014, 11:45:49 PM
Contributor
Joined: Dec 2013
Posts: 261

View Profile
JDI should auto-detect any functions added to the enigma_user namespace.
Logged
Offline (Unknown gender) lonewolff
Reply #3 Posted on: September 28, 2014, 11:47:26 PM
"Guest"


Email
JDI should auto-detect any functions added to the enigma_user namespace.

That was the part I didn't know. :)

Just testing now.  (Y)
Logged
Offline (Unknown gender) lonewolff
Reply #4 Posted on: September 28, 2014, 11:52:43 PM
"Guest"


Email
Ok I just added a new function 'test' in WINDOWSMain.h

Code: [Select]
namespace enigma_user
{
   unsigned long long window_handle();
   int sleep(int millis);

   void test();
}


And defined the function in DX9Context.h

Code: [Select]
void test()
{
   return;
}

and this

Code: [Select]
void enigma_user::test()
{
   return;
}

But the compiler says this

Quote
C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/SHELLmain.o:SHELLmain.cpp:(.text+0x1bb): undefined reference to `enigma_user::test()'

Any ideas what is going wrong?
« Last Edit: September 28, 2014, 11:54:32 PM by lonewolff » Logged
Offline (Unknown gender) sorlok_reaves
Reply #5 Posted on: September 28, 2014, 11:59:23 PM
Contributor
Joined: Dec 2013
Posts: 261

View Profile
Are you sure that last definition is not inside another namespace? (Also, it should probably be inside a .cpp file.)
Logged
Offline (Male) Goombert
Reply #6 Posted on: September 29, 2014, 12:25:49 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
He got it sorlok.

Platforms/General/PFwindow.h
Code: (C++) [Select]
namespace enigma_user {
void* window_device();
}

Bridges/Win32-Direct3D9/graphics_bridge.cpp
Code: (C++) [Select]
namespace enigma_user {
void* window_device() {
  return enigma::d3dmgr->device;
}
}

The reason I never sent this to master was because I didn't know how far we could throw it.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) lonewolff
Reply #7 Posted on: September 29, 2014, 12:31:27 AM
"Guest"


Email
Yep, that side compiles ok now :)

Making a simple DLL to test that it actually works.

That will take a little while, so I'll get back to you Rob :)
Logged
Offline (Unknown gender) lonewolff
Reply #8 Posted on: September 29, 2014, 12:56:15 AM
"Guest"


Email
Overall it fails I am afraid (project works fine in GM:S I had better add).

Probably something to do with whow you handle external DLL's or something (only guessing).

Quote
Building for mode (0)
Cleaning up from previous executions
 - Cleared parsed objects
 - Cleared room entries
 - Cleared shared locals list
 - Cleared event info
Loading shared locals from extensions list
Location in memory of structure: 49ff86b8
Copying resources:
Copying sprite names

Copying sound names

Copying background names

Copying path names

Copying script names

Copying shader names

Copying font names [1]
Copying timeline names

Copying object names [1]
Copying room names [1]
SYNTAX CHECKING AND PRIMARY PARSING:
0 Scripts:
"Linking" scripts
`Linking' 0 scripts and 0 timelines in 0 passes...
Completing script "Link"
Done.
Completing timeline "Link"
Done.
1 Objects:
 obj_quad: 12 events:
  Event[0]:   Parsing 1 sub-events:
Check `obj_quad::create... Done. Parse... Done.
  Event[8]:   Parsing 1 sub-events:
Check `obj_quad::draw... Done. Parse... Done.
Creating room creation code scope and parsing
"Linking" scripts into the objects...
"Linking" timelines into the objects...
"Link" complete.
Tabulating maximum argument passes to each script
Finished
Writing executable information and resources.
Writing modes and settings
Writing object switch
Writing resource names and maxima
Writing timeline control information
Writing events
Linking globals
Running Secondary Parse Passes
Writing object data
Writing local accessors
Writing font data
Writing room data
Writing shader data
Running make from `mingw32-make.exe'
Full command line: mingw32-make.exe Game WORKDIR="C:/ProgramData/ENIGMA/" GMODE=Run GRAPHICS=OpenGL1 AUDIO=OpenAL COLLISION=Precise WIDGETS=Win32 NETWORKING=None PLATFORM=Win32 CXXFLAGS="-I../Additional/i686-w64-mingw32/include" COMPILEPATH="Windows/Windows" EXTENSIONS=" Universal_System/Extensions/Alarms Universal_System/Extensions/Timelines Universal_System/Extensions/Paths Universal_System/Extensions/MotionPlanning Universal_System/Extensions/DateTime Universal_System/Extensions/ParticleSystems Universal_System/Extensions/DataStructures" OUTPUTNAME="D:/Users/Jason/AppData/Local/Temp/egm3653980965690431824.exe" eTCpath=""
mingw32-make.exe -C ENIGMAsystem/SHELL
mingw32-make.exe[1]: Entering directory `D:/Users/Jason/Downloads/ENIGMA/enigma-dev/ENIGMAsystem/SHELL'
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Audio_Systems/OpenAL/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Bridges/Win32-OpenGL1/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Collision_Systems/Precise/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Graphics_Systems/General/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Graphics_Systems/OpenGL1/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Platforms/Win32/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/Alarms/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/DataStructures/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/DateTime/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/MotionPlanning/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/ParticleSystems/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/Paths/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Universal_System/Extensions/Timelines/
mkdir.exe -p C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/Widget_Systems/Win32/
g++ -I../Additional/i686-w64-mingw32/include -IPlatforms/Win32/Info -IGraphics_Systems/OpenGL1/Info -IAudio_Systems/OpenAL/Info -ICollision_Systems/Precise/Info -IWidget_Systems/Win32/Info -INetworking_Systems/None/Info -IUniversal_System/Info -I. -IC:/ProgramData/ENIGMA/ -Wall -s -O3 -fno-exceptions  -MMD -MP -c -o C:/ProgramData/ENIGMA/.eobjs/Windows/Windows/Run/SHELLmain.o SHELLmain.cpp
In file included from SHELLmain.cpp:107:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In member function 'virtual variant enigma::OBJ_obj_quad::myevent_create()':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:46:40: error: conversion from 'void*' to 'variant' is ambiguous
     external_call(init, window_device());
                                        ^
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:46:39: note: candidates are:
     external_call(init, window_device());
                                       ^
In file included from Universal_System/var4.h:36:0,
                 from SHELLmain.cpp:28:
Universal_System/var4.h:92:29: note: variant::variant(const char*) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:111:2: note: in definition of macro 'types_extrapolate_string_p'
  prefix (const char *x) EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'const char*'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:111:2: note: in definition of macro 'types_extrapolate_string_p'
  prefix (const char *x) EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(long long unsigned int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:46:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigll x)   EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'long long unsigned int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:46:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigll x)   EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(long long int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:45:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (long long x) EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'long long int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:45:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (long long x) EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(unsigned int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:44:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigned x)  EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'unsigned int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:44:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigned x)  EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(long unsigned int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:43:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigl x)    EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'long unsigned int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:43:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (unsigl x)    EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(long int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:42:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (long x)      EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'long int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:42:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (long x)      EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note: variant::variant(int) <near match>
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:41:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (int x)       EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
Universal_System/var4.h:92:29: note:   no known conversion for argument 1 from 'void*' to 'int'
   types_extrapolate_alldecc(variant)
                             ^
Universal_System/var_te.h:41:2: note: in definition of macro 'types_extrapolate_real_p'
  prefix (int x)       EVCONST suffix\
  ^
Universal_System/var4.h:92:3: note: in expansion of macro 'types_extrapolate_alldecc'
   types_extrapolate_alldecc(variant)
   ^
In file included from ./Platforms/Win32/include.h:7:0,
                 from C:/ProgramData/ENIGMA/API_Switchboard.h:31,
                 from SHELLmain.cpp:58:
./Platforms/Win32/../General/PFexternals.h:36:9: error:   initializing argument 2 of 'variant enigma_user::external_call(int, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)'
 variant external_call(int id,variant a1=0,variant a2=0,variant a3=0,variant a4=0,variant a5=0,variant a6=0,variant a7=0,variant a8=0,
         ^
mingw32-make.exe[1]: Leaving directory `D:/Users/Jason/Downloads/ENIGMA/enigma-dev/ENIGMAsystem/SHELL'
mingw32-make.exe: *** [Game] Error 2

Oh and this is how I am interfacing with GM:S to let you know. I even changed the argument to a void* to make sure it fits with what we did to the source, Rob.

Code: [Select]
export double init(void* mD3dDevice)
{
d3dDevice=(IDirect3DDevice9*)mD3dDevice;

if(!d3dDevice)
return 1;

return 0;
}
« Last Edit: September 29, 2014, 01:01:51 AM by lonewolff » Logged
Offline (Male) Goombert
Reply #9 Posted on: September 29, 2014, 01:00:45 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Yeah, variant can not overload void* I am not sure how hard it would be to make it do that, but if we want pointers it needs to anyway. Regular pointers do work though, if u wanted to use that inside a script it might work as in window_device()->SomeD3DFunction();
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) lonewolff
Reply #10 Posted on: September 29, 2014, 01:04:18 AM
"Guest"


Email
Yeah, variant can not overload void* I am not sure how hard it would be to make it do that, but if we want pointers it needs to anyway. Regular pointers do work though, if u wanted to use that inside a script it might work as in window_device()->SomeD3DFunction();

LOL - nope not sure what you mean.

This is what I have in the calling script if that helps

Code: [Select]
dll_name="t.dll";

init=external_define(dll_name,"init",dll_cdecl,ty_real,1,ty_string);
create_quad=external_define(dll_name,"createQuad",dll_cdecl,ty_real,0);
draw_quad=external_define(dll_name,"drawQuad",dll_cdecl,ty_real,0);

external_call(init,window_device());
external_call(create_quad);
Logged
Offline (Male) Goombert
Reply #11 Posted on: September 29, 2014, 01:05:58 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Make a blank game with window_device()->EndScene(); and tell me if it compiles.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) lonewolff
Reply #12 Posted on: September 29, 2014, 01:09:08 AM
"Guest"


Email
Make a blank game with window_device()->EndScene(); and tell me if it compiles.

Line 3, position 17 (absolute 50): Expected primary expression before operator
Logged
Offline (Male) Goombert
Reply #13 Posted on: September 29, 2014, 01:13:13 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Parsing fail, we don't support -> yet I suppose. So yeah variant just needs overloaded with void*.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) lonewolff
Reply #14 Posted on: September 29, 2014, 01:15:34 AM
"Guest"


Email
Parsing fail, we don't support -> yet I suppose. So yeah variant just needs overloaded with void*.

So that is something you need to do on the ENIGMA source?
Logged
Pages: 1 2 3 4 »
  Print