Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #139

Closed
wants to merge 15 commits into from
Closed

test #139

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/raylib.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ else:
else: {.passC: "-DGRAPHICS_API_OPENGL_33".}

when defined(windows):
{.passC: "-DWIN32_LEAN_AND_MEAN".}
when defined(tcc): {.passL: "-lopengl32 -lgdi32 -lwinmm -lshell32".}
else: {.passL: "-static-libgcc -lopengl32 -lgdi32 -lwinmm".}

Expand Down Expand Up @@ -519,7 +520,7 @@ type
b*: uint8 ## Color blue value
a*: uint8 ## Color alpha value

Rectangle* {.importc: "rlRectangle", header: "raylib.h", completeStruct, bycopy.} = object ## Rectangle, 4 components
Rectangle* {.importc, header: "raylib.h", completeStruct, bycopy.} = object ## Rectangle, 4 components
x*: float32 ## Rectangle top-left corner position x
y*: float32 ## Rectangle top-left corner position y
width*: float32 ## Rectangle width
Expand Down Expand Up @@ -797,7 +798,7 @@ const

{.push callconv: cdecl, header: "raylib.h".}
proc initWindowImpl(width: int32, height: int32, title: cstring) {.importc: "InitWindow", sideEffect.}
proc closeWindow*() {.importc: "rlCloseWindow", sideEffect.}
proc closeWindow*() {.importc: "CloseWindow", sideEffect.}
## Close window and unload OpenGL context
proc windowShouldClose*(): bool {.importc: "WindowShouldClose", sideEffect.}
## Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
Expand Down Expand Up @@ -886,7 +887,7 @@ proc enableEventWaiting*() {.importc: "EnableEventWaiting", sideEffect.}
## Enable waiting for events on EndDrawing(), no automatic event polling
proc disableEventWaiting*() {.importc: "DisableEventWaiting", sideEffect.}
## Disable waiting for events on EndDrawing(), automatic events polling
proc showCursor*() {.importc: "rlShowCursor", sideEffect.}
proc showCursor*() {.importc: "ShowCursor", sideEffect.}
## Shows cursor
proc hideCursor*() {.importc: "HideCursor", sideEffect.}
## Hides cursor
Expand Down Expand Up @@ -1232,7 +1233,7 @@ func checkCollisionCircleLine*(center: Vector2, radius: float32, p1: Vector2, p2
## Check if circle collides with a line created betweeen two points [p1] and [p2]
func getCollisionRec*(rec1: Rectangle, rec2: Rectangle): Rectangle {.importc: "GetCollisionRec".}
## Get collision rectangle for two rectangles collision
proc loadImageImpl(fileName: cstring): Image {.importc: "rlLoadImage", sideEffect.}
proc loadImageImpl(fileName: cstring): Image {.importc: "LoadImage", sideEffect.}
proc loadImageRawImpl(fileName: cstring, width: int32, height: int32, format: PixelFormat, headerSize: int32): Image {.importc: "LoadImageRaw", sideEffect.}
proc loadImageAnimImpl(fileName: cstring, frames: out int32): Image {.importc: "LoadImageAnim", sideEffect.}
proc loadImageAnimFromMemoryImpl(fileType: cstring, fileData: ptr UncheckedArray[uint8], dataSize: int32, frames: ptr UncheckedArray[int32]): Image {.importc: "LoadImageAnimFromMemory", sideEffect.}
Expand Down Expand Up @@ -1434,8 +1435,8 @@ proc unloadFont(font: Font) {.importc: "UnloadFont", sideEffect.}
proc exportFontAsCodeImpl(font: Font, fileName: cstring): bool {.importc: "ExportFontAsCode", sideEffect.}
proc drawFPS*(posX: int32, posY: int32) {.importc: "DrawFPS", sideEffect.}
## Draw current FPS
proc drawTextImpl(text: cstring, posX: int32, posY: int32, fontSize: int32, color: Color) {.importc: "rlDrawText", sideEffect.}
proc drawTextImpl(font: Font, text: cstring, position: Vector2, fontSize: float32, spacing: float32, tint: Color) {.importc: "rlDrawTextEx", sideEffect.}
proc drawTextImpl(text: cstring, posX: int32, posY: int32, fontSize: int32, color: Color) {.importc: "DrawText", sideEffect.}
proc drawTextImpl(font: Font, text: cstring, position: Vector2, fontSize: float32, spacing: float32, tint: Color) {.importc: "DrawTextEx", sideEffect.}
proc drawTextImpl(font: Font, text: cstring, position: Vector2, origin: Vector2, rotation: float32, fontSize: float32, spacing: float32, tint: Color) {.importc: "DrawTextPro", sideEffect.}
proc drawTextCodepoint*(font: Font, codepoint: Rune, position: Vector2, fontSize: float32, tint: Color) {.importc: "DrawTextCodepoint", sideEffect.}
## Draw one character (codepoint)
Expand Down
60 changes: 30 additions & 30 deletions src/raylib/external/jar_xm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2373,23 +2373,23 @@ void jar_xm_debug(jar_xm_context_t *ctx) {
int x = 0, y = 0;

// DEBUG VARIABLES
y += size; rlDrawText(TextFormat("CUR TBL = %i", ctx->current_table_index), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("CUR PAT = %i", ctx->module.pattern_table[ctx->current_table_index]), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("POS JMP = %d", ctx->position_jump), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("JMP DST = %i", ctx->jump_dest), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("PTN BRK = %d", ctx->pattern_break), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("CUR ROW = %i", ctx->current_row), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("JMP ROW = %i", ctx->jump_row), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("ROW LCT = %i", ctx->row_loop_count), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("LCT = %i", ctx->loop_count), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("MAX LCT = %i", ctx->max_loop_count), x, y, size, WHITE);
y += size; DrawText(TextFormat("CUR TBL = %i", ctx->current_table_index), x, y, size, WHITE);
y += size; DrawText(TextFormat("CUR PAT = %i", ctx->module.pattern_table[ctx->current_table_index]), x, y, size, WHITE);
y += size; DrawText(TextFormat("POS JMP = %d", ctx->position_jump), x, y, size, WHITE);
y += size; DrawText(TextFormat("JMP DST = %i", ctx->jump_dest), x, y, size, WHITE);
y += size; DrawText(TextFormat("PTN BRK = %d", ctx->pattern_break), x, y, size, WHITE);
y += size; DrawText(TextFormat("CUR ROW = %i", ctx->current_row), x, y, size, WHITE);
y += size; DrawText(TextFormat("JMP ROW = %i", ctx->jump_row), x, y, size, WHITE);
y += size; DrawText(TextFormat("ROW LCT = %i", ctx->row_loop_count), x, y, size, WHITE);
y += size; DrawText(TextFormat("LCT = %i", ctx->loop_count), x, y, size, WHITE);
y += size; DrawText(TextFormat("MAX LCT = %i", ctx->max_loop_count), x, y, size, WHITE);
x = size * 12; y = 0;

y += size; rlDrawText(TextFormat("CUR TCK = %i", ctx->current_tick), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("XTR TCK = %i", ctx->extra_ticks), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("TCK/ROW = %i", ctx->tempo), x, y, size, ORANGE);
y += size; rlDrawText(TextFormat("SPL TCK = %f", ctx->remaining_samples_in_tick), x, y, size, WHITE);
y += size; rlDrawText(TextFormat("GEN SPL = %i", ctx->generated_samples), x, y, size, WHITE);
y += size; DrawText(TextFormat("CUR TCK = %i", ctx->current_tick), x, y, size, WHITE);
y += size; DrawText(TextFormat("XTR TCK = %i", ctx->extra_ticks), x, y, size, WHITE);
y += size; DrawText(TextFormat("TCK/ROW = %i", ctx->tempo), x, y, size, ORANGE);
y += size; DrawText(TextFormat("SPL TCK = %f", ctx->remaining_samples_in_tick), x, y, size, WHITE);
y += size; DrawText(TextFormat("GEN SPL = %i", ctx->generated_samples), x, y, size, WHITE);
y += size * 7;

x = 0;
Expand All @@ -2404,13 +2404,13 @@ void jar_xm_debug(jar_xm_context_t *ctx) {
};
};
if (i == ctx->current_table_index) {
// rlDrawText(TextFormat("%02X", ctx->current_tick), i * size * 2, y - size, size, WHITE);
// DrawText(TextFormat("%02X", ctx->current_tick), i * size * 2, y - size, size, WHITE);
DrawRectangle(i * size * 2, y, size * 2, size, RED);
rlDrawText(TextFormat("%02X", ctx->current_row), i * size * 2, y - size, size, YELLOW);
DrawText(TextFormat("%02X", ctx->current_row), i * size * 2, y - size, size, YELLOW);
} else {
DrawRectangle(i * size * 2, y, size * 2, size, ORANGE);
};
rlDrawText(TextFormat("%02X", ctx->module.pattern_table[i]), i * size * 2, y, size, WHITE);
DrawText(TextFormat("%02X", ctx->module.pattern_table[i]), i * size * 2, y, size, WHITE);
};
y += size;

Expand All @@ -2421,10 +2421,10 @@ void jar_xm_debug(jar_xm_context_t *ctx) {
x += 2 * size;
for(uint8_t i = 0; i < ctx->module.num_channels; i++) {
DrawRectangle(x, y, 8 * size, size, PURPLE);
rlDrawText("N", x, y, size, YELLOW);
rlDrawText("I", x + size * 2, y, size, YELLOW);
rlDrawText("V", x + size * 4, y, size, YELLOW);
rlDrawText("FX", x + size * 6, y, size, YELLOW);
DrawText("N", x, y, size, YELLOW);
DrawText("I", x + size * 2, y, size, YELLOW);
DrawText("V", x + size * 4, y, size, YELLOW);
DrawText("FX", x + size * 6, y, size, YELLOW);
x += 9 * size;
};
x += size;
Expand All @@ -2433,7 +2433,7 @@ void jar_xm_debug(jar_xm_context_t *ctx) {
x = 0;
if (j >=0 && j < (cur->num_rows)) {
DrawRectangle(x, y, size * 2, size, BROWN);
rlDrawText(TextFormat("%02X",j), x, y, size, WHITE);
DrawText(TextFormat("%02X",j), x, y, size, WHITE);
x += 2 * size;
for(uint8_t i = 0; i < ctx->module.num_channels; i++) {
if (j==(ctx->current_row)) {
Expand All @@ -2443,20 +2443,20 @@ void jar_xm_debug(jar_xm_context_t *ctx) {
};
jar_xm_pattern_slot_t *s = cur->slots + j * ctx->module.num_channels + i;
// jar_xm_channel_context_t *ch = ctx->channels + i;
if (s->note > 0) {rlDrawText(TextFormat("%s%s", xm_note_chr(s->note), xm_octave_chr(s->note) ), x, y, size, WHITE);} else {rlDrawText("...", x, y, size, GRAY);};
if (s->note > 0) {DrawText(TextFormat("%s%s", xm_note_chr(s->note), xm_octave_chr(s->note) ), x, y, size, WHITE);} else {DrawText("...", x, y, size, GRAY);};
if (s->instrument > 0) {
rlDrawText(TextFormat("%02X", s->instrument), x + size * 2, y, size, WHITE);
DrawText(TextFormat("%02X", s->instrument), x + size * 2, y, size, WHITE);
if (s->volume_column == 0) {
rlDrawText(TextFormat("%02X", 64), x + size * 4, y, size, YELLOW);
DrawText(TextFormat("%02X", 64), x + size * 4, y, size, YELLOW);
};
} else {
rlDrawText("..", x + size * 2, y, size, GRAY);
DrawText("..", x + size * 2, y, size, GRAY);
if (s->volume_column == 0) {
rlDrawText("..", x + size * 4, y, size, GRAY);
DrawText("..", x + size * 4, y, size, GRAY);
};
};
if (s->volume_column > 0) {rlDrawText(TextFormat("%02X", (s->volume_column - 16)), x + size * 4, y, size, WHITE);};
if (s->effect_type > 0 || s->effect_param > 0) {rlDrawText(TextFormat("%s%02X", xm_effect_chr(s->effect_type), s->effect_param), x + size * 6, y, size, WHITE);};
if (s->volume_column > 0) {DrawText(TextFormat("%02X", (s->volume_column - 16)), x + size * 4, y, size, WHITE);};
if (s->effect_type > 0 || s->effect_param > 0) {DrawText(TextFormat("%s%02X", xm_effect_chr(s->effect_type), s->effect_param), x + size * 6, y, size, WHITE);};
x += 9 * size;
};
};
Expand Down
10 changes: 5 additions & 5 deletions src/raylib/platforms/rcore_android.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
CORE.Input.Mouse.cursorHidden = false;
}
Expand Down Expand Up @@ -1004,24 +1004,24 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
#if defined(SUPPORT_MODULE_RSHAPES)
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
rlRectangle rec = GetFontDefault().recs[95];
Rectangle rec = GetFontDefault().recs[95];
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
{
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
SetShapesTexture(GetFontDefault().texture, (rlRectangle){ rec.x + 2, rec.y + 2, 1, 1 });
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
}
else
{
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
SetShapesTexture(GetFontDefault().texture, (rlRectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
}
#endif
#else
#if defined(SUPPORT_MODULE_RSHAPES)
// Set default texture and rectangle to be used for shapes drawing
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
SetShapesTexture(texture, (rlRectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes
SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/raylib/platforms/rcore_desktop_glfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
glfwSetInputMode(platform.handle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
CORE.Input.Mouse.cursorHidden = false;
Expand Down
2 changes: 1 addition & 1 deletion src/raylib/platforms/rcore_desktop_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
SDL_ShowCursor(SDL_ENABLE);

Expand Down
4 changes: 2 additions & 2 deletions src/raylib/platforms/rcore_drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ typedef struct {
char currentButtonStateEvdev[MAX_MOUSE_BUTTONS]; // Holds the new mouse state for the next polling event to grab
bool cursorRelative; // Relative cursor mode
int mouseFd; // File descriptor for the evdev mouse/touch/gestures
rlRectangle absRange; // Range of values for absolute pointing devices (touchscreens)
Rectangle absRange; // Range of values for absolute pointing devices (touchscreens)
int touchSlot; // Hold the touch slot number of the currently being sent multitouch block

// Gamepad data
Expand Down Expand Up @@ -510,7 +510,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
CORE.Input.Mouse.cursorHidden = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/raylib/platforms/rcore_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
CORE.Input.Mouse.cursorHidden = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/raylib/platforms/rcore_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ const char *GetClipboardText(void)
}

// Show mouse cursor
void rlShowCursor(void)
void ShowCursor(void)
{
if (CORE.Input.Mouse.cursorHidden)
{
Expand Down
Loading
Loading