removed pointless pointers in line and circle
This commit is contained in:
parent
56175ccb1b
commit
bbffbe1cb3
5 changed files with 18 additions and 18 deletions
|
|
@ -10,9 +10,9 @@ extern "C" {
|
||||||
#include "arc/math/circle.h"
|
#include "arc/math/circle.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void ARC_Circle_Render(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color);
|
void ARC_Circle_Render(ARC_Circle circle, ARC_Renderer *renderer, ARC_Color color);
|
||||||
|
|
||||||
void ARC_Circle_RenderFill(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color);
|
void ARC_Circle_RenderFill(ARC_Circle circle, ARC_Renderer *renderer, ARC_Color color);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ extern "C" {
|
||||||
|
|
||||||
#include "arc/graphics/color.h"
|
#include "arc/graphics/color.h"
|
||||||
#include "arc/graphics/renderer.h"
|
#include "arc/graphics/renderer.h"
|
||||||
#include "arc/math/rectangle.h"
|
#include "arc/math/point.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color);
|
void ARC_Line_Render(ARC_Point point1, ARC_Point point2, ARC_Renderer *renderer, ARC_Color color);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
#include <SDL2_gfxPrimitives.h>
|
#include <SDL2_gfxPrimitives.h>
|
||||||
|
|
||||||
//Modified from https://stackoverflow.com/questions/38334081/how-to-draw-circles-arcs-and-vector-graphics-in-sdl
|
//Modified from https://stackoverflow.com/questions/38334081/how-to-draw-circles-arcs-and-vector-graphics-in-sdl
|
||||||
void ARC_Circle_Render(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color){
|
void ARC_Circle_Render(ARC_Circle circle, ARC_Renderer *renderer, ARC_Color color){
|
||||||
circleRGBA((SDL_Renderer *)renderer, (Sint16)circle->x, (Sint16)circle->y, (Sint16)circle->r, (Uint8)color->r, (Uint8)color->g, (Uint8)color->b, (Uint8)color->a);
|
circleRGBA((SDL_Renderer *)renderer, (Sint16)circle.x, (Sint16)circle.y, (Sint16)circle.r, (Uint8)color.r, (Uint8)color.g, (Uint8)color.b, (Uint8)color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: very temp
|
//TODO: very temp
|
||||||
void ARC_Circle_RenderFill(ARC_Circle *circle, ARC_Renderer *renderer, ARC_Color *color){
|
void ARC_Circle_RenderFill(ARC_Circle circle, ARC_Renderer *renderer, ARC_Color color){
|
||||||
filledCircleRGBA((SDL_Renderer *)renderer, (Sint16)circle->x, (Sint16)circle->y, (Sint16)circle->r, (Uint8)color->r, (Uint8)color->g, (Uint8)color->b, (Uint8)color->a);
|
filledCircleRGBA((SDL_Renderer *)renderer, (Sint16)circle.x, (Sint16)circle.y, (Sint16)circle.r, (Uint8)color.r, (Uint8)color.g, (Uint8)color.b, (Uint8)color.a);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
#include "arc/graphics/line.h"
|
#include "arc/graphics/line.h"
|
||||||
#include "renderer.h"
|
#include "renderer.h"
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
void ARC_Line_Render(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2, ARC_Renderer *renderer, ARC_Color *color){
|
void ARC_Line_Render(ARC_Point point1, ARC_Point point2, ARC_Renderer *renderer, ARC_Color color){
|
||||||
SDL_SetRenderDrawColor((SDL_Renderer *)renderer, color->r, color->g, color->b, color->a);
|
SDL_SetRenderDrawColor((SDL_Renderer *)renderer, color.r, color.g, color.b, color.a);
|
||||||
SDL_RenderDrawLine((SDL_Renderer *)renderer, *x1, *y1, *x2, *y2);
|
SDL_RenderDrawLine((SDL_Renderer *)renderer, point1.x, point1.y, point2.x, point2.y);
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include "arc/std/errno.h"
|
#include "arc/std/errno.h"
|
||||||
#include "arc/std/handler.h"
|
#include "arc/std/handler.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <time.h>
|
||||||
|
|
||||||
void ARC_EngineData_VectorDestroyStateFn(void *data){
|
void ARC_EngineData_VectorDestroyStateFn(void *data){
|
||||||
ARC_State_Destroy((ARC_State *)data);
|
ARC_State_Destroy((ARC_State *)data);
|
||||||
|
|
@ -68,16 +68,17 @@ void ARC_Engine_RunUncapped(ARC_EngineData *data){
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: probably want to do this in a better way
|
//TODO: probably want to do this in a better way
|
||||||
struct timeval currentTime;
|
struct timespec currentTime;
|
||||||
struct timeval lastTime;
|
struct timespec lastTime;
|
||||||
|
|
||||||
gettimeofday(¤tTime, NULL);
|
clock_gettime(CLOCK_MONOTONIC, ¤tTime);
|
||||||
|
|
||||||
lastTime = currentTime;
|
lastTime = currentTime;
|
||||||
|
|
||||||
data->running = ARC_True;
|
data->running = ARC_True;
|
||||||
while(data->running){
|
while(data->running){
|
||||||
data->dt = (lastTime.tv_sec - currentTime.tv_sec) + (lastTime.tv_usec - currentTime.tv_usec);
|
clock_gettime(CLOCK_MONOTONIC, ¤tTime);
|
||||||
|
data->dt = (currentTime.tv_sec + (currentTime.tv_nsec * 0.000000001)) - (lastTime.tv_sec + (lastTime.tv_nsec * 0.000000001));
|
||||||
lastTime = currentTime;
|
lastTime = currentTime;
|
||||||
|
|
||||||
data->running = ARC_Input_Update(data->input);
|
data->running = ARC_Input_Update(data->input);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue