diff options
| author | realtradam <[email protected]> | 2022-01-04 15:13:45 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-01-04 15:13:45 -0500 |
| commit | 64a4ef67c5c976641e13c4a81f2e6c1c1c063084 (patch) | |
| tree | 3e1fe279b40bad2dc662087d8f1af720ba7e7d7b /src/example.c | |
| parent | 314c1e92fd66facd6818f29cd53d62ab2fd57573 (diff) | |
| download | sample-mruby-gem-64a4ef67c5c976641e13c4a81f2e6c1c1c063084.tar.gz sample-mruby-gem-64a4ef67c5c976641e13c4a81f2e6c1c1c063084.zip | |
.
Diffstat (limited to 'src/example.c')
| -rw-r--r-- | src/example.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/example.c b/src/example.c index 146ea35..c5d573c 100644 --- a/src/example.c +++ b/src/example.c @@ -1,15 +1,54 @@ #include <mruby.h> #include <mruby/string.h> #include <stdio.h> +#include "raylib.h" +const int screenWidth = 800; +const int screenHeight = 450; static mrb_value mrb_c_method(mrb_state *mrb, mrb_value self) { //mrb_ensure_string_type(mrb, self); //printf("%s: A C Extension\n", mrb_str_to_cstr(mrb, self)); - printf("A C Extension\n"); + // Initialization + //-------------------------------------------------------------------------------------- - return self; + InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + + Texture2D texture = LoadTexture("assets/HYPERS.png"); + struct Vector2 position = { 0, 0 }; + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // TODO: Update your variables here + //---------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + DrawTextureEx(texture, position, 0.0f, 4.0f, WHITE); + + DrawText("HYPERS!", 500, 50, 20, RED); + + EndDrawing(); + //---------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; } void |
