summaryrefslogtreecommitdiffhomepage
path: root/src/example.c
blob: c5d573ce328812b670f1761a0e115e3891df1109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#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));
	// Initialization
	//--------------------------------------------------------------------------------------

	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
mrb_my_silly_extension_gem_init(mrb_state* mrb) {
	struct RClass *class_cextension = mrb_define_module(mrb, "CRubyExtension");
	mrb_define_class_method(mrb, class_cextension, "c_method", mrb_c_method, MRB_ARGS_NONE());
}

void
mrb_my_silly_extension_gem_final(mrb_state* mrb) {
	/* finalizer */
}