Replies: 1 comment
-
all the code .. #include <stdio.h> #include "gravity_compiler.h" #include #include #include <raylib.h> Texture2D texBunny; using namespace std; static int ENTITY_INDEX = 0; #define MAX_BUNNIES 50000 / // error callback
} class Entity; class MainClass public:
}; class GameScript: public MainClass
// cout << "GameScript destructor called." << endl;
void render()
}; std::vector<Entity*> entitys; class Entity: public MainClass
// DrawTexture(texBunny, 100,100,WHITE);
}; //******************************************************* static bool gamescrip_create (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex)
} static bool gamescrip_update (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) static bool gamescrip_ready (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) static bool gamescript_set_entity (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex)
// entity->setScript(gameScript);
cout << "set entity "<className<< " " <index << endl;
} void register_gamescript_classes (gravity_vm *vm) {
} //******************************************************* static bool entity_create (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex)
} static bool entity_set_script (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex)
gravity_object_t *object = NULL;
// entity->setScript(gameScript);
/// cout << "set GameScript "<className<< " " <index << endl; // cout << "set GameScript "<className<< " " <index << endl;
} static bool entity_update (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_render (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_name_get (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_name_set (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_x_get (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_x_set (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) {
} static bool entity_y_get (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) { static bool entity_y_set (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) {
}
} //******************************************* static bool input_mouse_down (gravity_vm *vm, gravity_value_t *args, uint16_t nargs, uint32_t rindex) {
}
} static void object_free (gravity_vm *vm, gravity_object_t *obj) bool RunUpdate(gravity_vm *vm)
} bool RunReady(gravity_vm *vm)
} bool RunRender(gravity_vm *vm)
} int main(int argc, const char * argv[]) { const int screenWidth = 900; // setup a minimal delegate const char* source_code = R"( extern var Entity; class Bunny : GameScript
/// System.print("Bunny instantiated " );
} func ready() var player = Entity() return 1 func update(dt)
return 1 func render() return 1
// gravity_closure_t *closureUpdate=NULL; RunReady(vm);
UnloadTexture(texBunny); // Unload bunny texture CloseWindow();
} |
Beta Was this translation helpful? Give feedback.
-
Hi, is possible to call a function from Scrip with a class Inherited from c class
c:
class GameScript:..
... void update(float dt)
{
script:
class Bunny : GameScript
... func update(dt)
Beta Was this translation helpful? Give feedback.
All reactions