|
|
@ -48,6 +48,7 @@ static sg_image image_itemframe_selected;
|
|
|
|
static sg_image image_thrusterburn;
|
|
|
|
static sg_image image_thrusterburn;
|
|
|
|
static sg_image image_player;
|
|
|
|
static sg_image image_player;
|
|
|
|
static sg_image image_cockpit_used;
|
|
|
|
static sg_image image_cockpit_used;
|
|
|
|
|
|
|
|
static sg_image image_stars;
|
|
|
|
static int cur_editing_boxtype = -1;
|
|
|
|
static int cur_editing_boxtype = -1;
|
|
|
|
static int cur_editing_rotation = 0;
|
|
|
|
static int cur_editing_rotation = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -153,6 +154,7 @@ init(void)
|
|
|
|
image_itemframe_selected = load_image("loaded/itemframe_selected.png");
|
|
|
|
image_itemframe_selected = load_image("loaded/itemframe_selected.png");
|
|
|
|
image_player = load_image("loaded/player.png");
|
|
|
|
image_player = load_image("loaded/player.png");
|
|
|
|
image_cockpit_used = load_image("loaded/cockpit_used.png");
|
|
|
|
image_cockpit_used = load_image("loaded/cockpit_used.png");
|
|
|
|
|
|
|
|
image_stars = load_image("loaded/stars.png");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// socket initialization
|
|
|
|
// socket initialization
|
|
|
@ -548,7 +550,7 @@ frame(void)
|
|
|
|
sgp_set_blend_mode(SGP_BLENDMODE_BLEND);
|
|
|
|
sgp_set_blend_mode(SGP_BLENDMODE_BLEND);
|
|
|
|
|
|
|
|
|
|
|
|
// Draw background color
|
|
|
|
// Draw background color
|
|
|
|
set_color(colhexcode(0x020509));
|
|
|
|
set_color(colhexcode(0x000000));
|
|
|
|
// sgp_set_color(0.1f, 0.1f, 0.1f, 1.0f);
|
|
|
|
// sgp_set_color(0.1f, 0.1f, 0.1f, 1.0f);
|
|
|
|
sgp_clear();
|
|
|
|
sgp_clear();
|
|
|
|
|
|
|
|
|
|
|
@ -559,9 +561,59 @@ frame(void)
|
|
|
|
sgp_translate(width / 2, height / 2);
|
|
|
|
sgp_translate(width / 2, height / 2);
|
|
|
|
sgp_scale_at(zoom, -zoom, 0.0f, 0.0f);
|
|
|
|
sgp_scale_at(zoom, -zoom, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// parllax layers, just the zooming, but not 100% of the camera panning
|
|
|
|
|
|
|
|
#if 1 // space background
|
|
|
|
|
|
|
|
transform_scope
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
V2 scaled_camera_pos = V2scale(camera_pos, 0.1f); // this is how strong/weak the parallax is
|
|
|
|
|
|
|
|
sgp_translate(-scaled_camera_pos.x, -scaled_camera_pos.y);
|
|
|
|
|
|
|
|
set_color(WHITE);
|
|
|
|
|
|
|
|
sgp_set_image(0, image_stars);
|
|
|
|
|
|
|
|
float stars_height_over_width = (float)sg_query_image_info(image_stars).height / (float)sg_query_image_info(image_stars).width;
|
|
|
|
|
|
|
|
const float stars_width = 35.0f;
|
|
|
|
|
|
|
|
float stars_height = stars_width * stars_height_over_width;
|
|
|
|
|
|
|
|
sgp_draw_textured_rect(-stars_width / 2.0f, -stars_height / 2.0f, stars_width, stars_height);
|
|
|
|
|
|
|
|
//sgp_draw_textured_rect(0, 0, stars_width, stars_height);
|
|
|
|
|
|
|
|
sgp_reset_image(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// camera go to player
|
|
|
|
// camera go to player
|
|
|
|
sgp_translate(-camera_pos.x, -camera_pos.y);
|
|
|
|
sgp_translate(-camera_pos.x, -camera_pos.y);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0 // radius of viewership, dots which contextualize stuff
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
set_color(WHITE);
|
|
|
|
|
|
|
|
for (float r = 1.0f; r <= VISION_RADIUS; r += 1.0f)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (float theta = 0.0f; theta < 2.0f * PI; theta += 0.1f)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
V2 pos = V2scale((V2){ cosf(theta), sinf(theta) }, r);
|
|
|
|
|
|
|
|
sgp_draw_point(pos.x, pos.y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 1 // test grid of dots
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sgp_set_color(1.0f, 1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
|
|
const int num = 100;
|
|
|
|
|
|
|
|
for (int x = -num; x < num; x++) {
|
|
|
|
|
|
|
|
for (int y = -num; y < num; y++) {
|
|
|
|
|
|
|
|
float gap = 0.5f;
|
|
|
|
|
|
|
|
V2 star = (V2){ (float)x * gap, (float)y * gap };
|
|
|
|
|
|
|
|
if (fabsf(star.x - camera_pos.x) > VISION_RADIUS)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (fabsf(star.y - camera_pos.y) > VISION_RADIUS)
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
star.x += hash11(star.x*100.0f + star.y*67.0f);
|
|
|
|
|
|
|
|
star.y += hash11(star.y*93.0f + star.x*53.0f);
|
|
|
|
|
|
|
|
sgp_draw_point(star.x, star.y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// hand reached limit circle
|
|
|
|
// hand reached limit circle
|
|
|
|
if (myentity() != NULL) {
|
|
|
|
if (myentity() != NULL) {
|
|
|
|
static float hand_reach_alpha = 1.0f;
|
|
|
|
static float hand_reach_alpha = 1.0f;
|
|
|
@ -570,18 +622,9 @@ frame(void)
|
|
|
|
draw_circle(entity_pos(myentity()), MAX_HAND_REACH);
|
|
|
|
draw_circle(entity_pos(myentity()), MAX_HAND_REACH);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// stars
|
|
|
|
|
|
|
|
sgp_set_color(1.0f, 1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
|
|
const int num = 30;
|
|
|
|
|
|
|
|
for (int x = -num; x < num; x++) {
|
|
|
|
|
|
|
|
for (int y = -num; y < num; y++) {
|
|
|
|
|
|
|
|
sgp_draw_point((float)x * 0.1f, (float)y * 0.1f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float halfbox = BOX_SIZE / 2.0f;
|
|
|
|
float halfbox = BOX_SIZE / 2.0f;
|
|
|
|
|
|
|
|
|
|
|
|
// mouse
|
|
|
|
// mouse frozen, debugging tool
|
|
|
|
if (mouse_frozen) {
|
|
|
|
if (mouse_frozen) {
|
|
|
|
sgp_set_color(1.0f, 0.0f, 0.0f, 0.5f);
|
|
|
|
sgp_set_color(1.0f, 0.0f, 0.0f, 0.5f);
|
|
|
|
sgp_draw_filled_rect(world_mouse_pos.x, world_mouse_pos.y, 0.1f, 0.1f);
|
|
|
|
sgp_draw_filled_rect(world_mouse_pos.x, world_mouse_pos.y, 0.1f, 0.1f);
|
|
|
@ -668,13 +711,14 @@ frame(void)
|
|
|
|
draw_color_rect_centered(box_pos(b), BOX_SIZE);
|
|
|
|
draw_color_rect_centered(box_pos(b), BOX_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// draw the velocity
|
|
|
|
sgp_set_color(1.0f, 0.0f, 0.0f, 1.0f);
|
|
|
|
sgp_set_color(1.0f, 0.0f, 0.0f, 1.0f);
|
|
|
|
V2 vel = grid_vel(g);
|
|
|
|
V2 vel = grid_vel(g);
|
|
|
|
V2 to = V2add(grid_com(g), vel);
|
|
|
|
V2 to = V2add(grid_com(g), vel);
|
|
|
|
sgp_draw_line(grid_com(g).x, grid_com(g).y, to.x, to.y);
|
|
|
|
sgp_draw_line(grid_com(g).x, grid_com(g).y, to.x, to.y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (e->is_player && get_entity(&gs, e->currently_piloting_seat) == NULL) {
|
|
|
|
if (e->is_player && get_entity(&gs, e->currently_piloting_seat) == NULL) {
|
|
|
|
|
|
|
|
|
|
|
|
transform_scope
|
|
|
|
transform_scope
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sgp_rotate_at(entity_rotation(e), entity_pos(e).x, entity_pos(e).y);
|
|
|
|
sgp_rotate_at(entity_rotation(e), entity_pos(e).x, entity_pos(e).y);
|
|
|
@ -693,7 +737,7 @@ frame(void)
|
|
|
|
dbg_drawall();
|
|
|
|
dbg_drawall();
|
|
|
|
} // world space transform end
|
|
|
|
} // world space transform end
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// UI drawn in screen space
|
|
|
|
// UI drawn in screen space
|
|
|
|
ui(true, dt, width, height);
|
|
|
|
ui(true, dt, width, height);
|
|
|
|