More player-tints. Escape to quit when in main-menu.
This commit is contained in:
@@ -84,12 +84,15 @@ static void state_tick(Presentation_State *state) {
|
|||||||
ctx->simulation_accumulator -= sim_dt;
|
ctx->simulation_accumulator -= sim_dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: SS - I believe that this is where we should send game-messages to the clients and the host.
|
||||||
|
|
||||||
{ // TEMP: SS
|
{ // TEMP: SS
|
||||||
if(IsKeyPressed(KEY_TAB)) {
|
if(IsKeyPressed(KEY_TAB)) {
|
||||||
ctx->debug_draw_session_details = !ctx->debug_draw_session_details;
|
ctx->debug_draw_session_details = !ctx->debug_draw_session_details;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsKeyPressed(KEY_ESCAPE)) {
|
if(IsKeyPressed(KEY_ESCAPE)) {
|
||||||
|
// TODO: SS - Show pause-menu instead.
|
||||||
presentation_state_machine_go_to(&presentation_state_main_menu);
|
presentation_state_machine_go_to(&presentation_state_main_menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,11 +102,32 @@ uint32_t floor_texture_variant(uint32_t x, uint32_t y, uint32_t seed, uint32_t n
|
|||||||
return (wang_hash(x * 73856093u ^ y * 19349663u ^ seed)) % num_variants;
|
return (wang_hash(x * 73856093u ^ y * 19349663u ^ seed)) % num_variants;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color get_tint_for_player_id(uint16_t player_id) {
|
Color get_tint_for_player_id(uint16_t player_id) { // TODO: SS - Could get values from 'the active color-palette'.
|
||||||
switch(player_id) {
|
switch(player_id) {
|
||||||
case 0: {
|
case 0: {
|
||||||
return (Color) { 255, 135, 102, 255 };
|
return (Color) { 255, 135, 102, 255 };
|
||||||
}
|
}
|
||||||
|
case 1: {
|
||||||
|
return (Color) { 230, 204, 138, 255 };
|
||||||
|
}
|
||||||
|
case 3: {
|
||||||
|
return (Color) { 240, 236, 226, 255 };
|
||||||
|
}
|
||||||
|
case 4: {
|
||||||
|
return (Color) { 77, 106, 148, 255 };
|
||||||
|
}
|
||||||
|
case 5: {
|
||||||
|
return (Color) { 36, 43, 74, 255 };
|
||||||
|
}
|
||||||
|
case 6: {
|
||||||
|
return (Color) { 153, 92, 149, 255 };
|
||||||
|
}
|
||||||
|
case 7: {
|
||||||
|
return (Color) { 245, 79, 79, 255 };
|
||||||
|
}
|
||||||
|
case 8: {
|
||||||
|
return (Color) { 53, 121, 133, 255 };
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return (Color) { 82, 33, 110, 255 };
|
return (Color) { 82, 33, 110, 255 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ static void state_enter(Presentation_State *state) {
|
|||||||
(void)ctx;
|
(void)ctx;
|
||||||
|
|
||||||
ctx->mode = Main_Menu_Mode_Home;
|
ctx->mode = Main_Menu_Mode_Home;
|
||||||
|
|
||||||
|
SetExitKey(KEY_ESCAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void state_tick(Presentation_State *state) {
|
static void state_tick(Presentation_State *state) {
|
||||||
@@ -163,6 +165,8 @@ static void state_render(Presentation_State *state) {
|
|||||||
static void state_exit(Presentation_State *state) {
|
static void state_exit(Presentation_State *state) {
|
||||||
(void)state;
|
(void)state;
|
||||||
printf("Exited main menu\n");
|
printf("Exited main menu\n");
|
||||||
|
|
||||||
|
SetExitKey(KEY_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Presentation_State presentation_state_main_menu;
|
Presentation_State presentation_state_main_menu;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ static bool start_listening(Game_Networking *networking) {
|
|||||||
assert(networking != NULL);
|
assert(networking != NULL);
|
||||||
assert(networking->api != NULL);
|
assert(networking->api != NULL);
|
||||||
|
|
||||||
int listener_id = mp_api_listen(networking->api, listen_callback, (void *)networking); // TODO: SS - Change context.
|
int listener_id = mp_api_listen(networking->api, listen_callback, (void *)networking);
|
||||||
if(listener_id < 0) {
|
if(listener_id < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,8 @@ bool networking_try_join(Game_Networking *networking, Game_Session *session, con
|
|||||||
// Or, should this client receive the current state of the session?
|
// Or, should this client receive the current state of the session?
|
||||||
|
|
||||||
if(received_json != NULL) {
|
if(received_json != NULL) {
|
||||||
// TODO: SS - Read this json because it might contain valuable information.
|
// TODO: SS - Read this json. It should contain valuable information about the session.
|
||||||
|
|
||||||
json_decref(received_json);
|
json_decref(received_json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user