Doing some code reshuffling
This commit is contained in:
		@@ -39,6 +39,21 @@ add_subdirectory(tools)
 | 
				
			|||||||
if(TARGET_TYPE STREQUAL test)
 | 
					if(TARGET_TYPE STREQUAL test)
 | 
				
			||||||
  add_subdirectory(test)
 | 
					  add_subdirectory(test)
 | 
				
			||||||
elseif(TARGET_TYPE STREQUAL game)
 | 
					elseif(TARGET_TYPE STREQUAL game)
 | 
				
			||||||
 | 
					  # Set up shared assets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Shaders
 | 
				
			||||||
 | 
					  tool_copy(shader_textured
 | 
				
			||||||
 | 
					    shared/shaders/textured.vert shaders/textured.vert
 | 
				
			||||||
 | 
					    shared/shaders/textured.frag shaders/textured.frag
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Fonts
 | 
				
			||||||
 | 
					  tool_copy(font_opensans
 | 
				
			||||||
 | 
					    shared/fonts/opensans/OpenSans-Regular.ttf fonts/opensans/OpenSans-Regular.ttf
 | 
				
			||||||
 | 
					    shared/fonts/opensans/OpenSans-Bold.ttf fonts/opensans/OpenSans-Bold.ttf
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Poker Game
 | 
				
			||||||
  if(TARGET_GAME STREQUAL poker)
 | 
					  if(TARGET_GAME STREQUAL poker)
 | 
				
			||||||
    add_compile_definitions(
 | 
					    add_compile_definitions(
 | 
				
			||||||
      GAME_NAME="Penny's Poker"
 | 
					      GAME_NAME="Penny's Poker"
 | 
				
			||||||
@@ -51,24 +66,26 @@ elseif(TARGET_TYPE STREQUAL game)
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    set(DIR_CHARS poker/characters)
 | 
					    set(DIR_CHARS poker/characters)
 | 
				
			||||||
    tool_vn_character(penny
 | 
					    tool_vn_character(vn_penny
 | 
				
			||||||
      ${DIR_CHARS}/penny/character.xml ${DIR_CHARS}/penny.png
 | 
					      ${DIR_CHARS}/penny/character.xml ${DIR_CHARS}/penny.png
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    tool_vn_character(lucy
 | 
					    tool_vn_character(vn_lucy
 | 
				
			||||||
      ${DIR_CHARS}/lucy/character.xml ${DIR_CHARS}/lucy.png
 | 
					      ${DIR_CHARS}/lucy/character.xml ${DIR_CHARS}/lucy.png
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    tool_vn_character(jenny
 | 
					    tool_vn_character(vn_julie
 | 
				
			||||||
      ${DIR_CHARS}/jenny/character.xml ${DIR_CHARS}/jenny.png
 | 
					      ${DIR_CHARS}/julie/character.xml ${DIR_CHARS}/julie.png
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    tool_vn_character(sammy
 | 
					    tool_vn_character(vn_sammy
 | 
				
			||||||
      ${DIR_CHARS}/sammy/character.xml ${DIR_CHARS}/sammy.png
 | 
					      ${DIR_CHARS}/sammy/character.xml ${DIR_CHARS}/sammy.png
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tool_assets(
 | 
					    tool_assets(
 | 
				
			||||||
      penny
 | 
					      shader_textured
 | 
				
			||||||
      lucy
 | 
					      font_opensans
 | 
				
			||||||
      jenny
 | 
					      vn_penny
 | 
				
			||||||
      sammy
 | 
					      vn_lucy
 | 
				
			||||||
 | 
					      vn_julie
 | 
				
			||||||
 | 
					      vn_sammy
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  endif()
 | 
					  endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "../util/math.h"
 | 
					#include "../util/math.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "player.h"
 | 
					#include "player.h"
 | 
				
			||||||
#include "pot.h"
 | 
					#include "pot.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "card.h"
 | 
					#include "card.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "../util/flags.h"
 | 
					#include "../util/flags.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "bet.h"
 | 
					#include "bet.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "../util/flags.h"
 | 
					#include "../util/flags.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "card.h"
 | 
					#include "card.h"
 | 
				
			||||||
#include "pot.h"
 | 
					#include "pot.h"
 | 
				
			||||||
#include "bet.h"
 | 
					#include "bet.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "../util/array.h"
 | 
					#include "../util/array.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Adds a new pot to the poker game instance.
 | 
					 * Adds a new pot to the poker game instance.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "../util/math.h"
 | 
					#include "../util/math.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "bet.h"
 | 
					#include "bet.h"
 | 
				
			||||||
#include "card.h"
 | 
					#include "card.h"
 | 
				
			||||||
#include "winner.h"
 | 
					#include "winner.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
#include "../libs.h"
 | 
					#include "../libs.h"
 | 
				
			||||||
#include "card.h"
 | 
					#include "card.h"
 | 
				
			||||||
#include "fuck.h"
 | 
					#include "common.h"
 | 
				
			||||||
#include "player.h"
 | 
					#include "player.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								test/util/array.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								test/util/array.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Copyright (c) 2021 Dominic Masters
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This software is released under the MIT License.
 | 
				
			||||||
 | 
					 * https://opensource.org/licenses/MIT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "array.h"
 | 
				
			||||||
							
								
								
									
										12
									
								
								test/util/array.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								test/util/array.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Copyright (c) 2021 Dominic Masters
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * This software is released under the MIT License.
 | 
				
			||||||
 | 
					 * https://opensource.org/licenses/MIT
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					#include <unity.h>
 | 
				
			||||||
 | 
					#include <util/array.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int test_array_h();
 | 
				
			||||||
@@ -9,4 +9,27 @@ function(tool_assets args)
 | 
				
			|||||||
    DEPENDS ${ARGV}
 | 
					    DEPENDS ${ARGV}
 | 
				
			||||||
    COMMENT "Compressing Assets"
 | 
					    COMMENT "Compressing Assets"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
 | 
					endfunction()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function(tool_copy target)
 | 
				
			||||||
 | 
					  math(EXPR CARGSN "${ARGC} - 1")
 | 
				
			||||||
 | 
					  set(LOOP_DEPENDENCIES)
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  foreach(index RANGE 1 ${CARGSN} 2)
 | 
				
			||||||
 | 
					    math(EXPR indexnext "${index} + 1")
 | 
				
			||||||
 | 
					    set(LOOP_TARGET "item_${target}_${index}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    LIST(GET ARGV ${index} from)
 | 
				
			||||||
 | 
					    LIST(GET ARGV ${indexnext} to)
 | 
				
			||||||
 | 
					    LIST(APPEND LOOP_DEPENDENCIES ${LOOP_TARGET})
 | 
				
			||||||
 | 
					    add_custom_command(OUTPUT ${LOOP_TARGET}
 | 
				
			||||||
 | 
					      COMMAND ${CMAKE_COMMAND} -E copy "${ROOT_DIR}/${ASSETS_DIR}/${from}" "${ASSETS_DIR}/${to}"
 | 
				
			||||||
 | 
					      COMMENT "Copying ${from} => ${to}"
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  endforeach()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  add_custom_target(${target}
 | 
				
			||||||
 | 
					    DEPENDS ${MY_LIST}
 | 
				
			||||||
 | 
					    COMMENT "Copying ${FILE_NAME}"
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
endfunction()
 | 
					endfunction()
 | 
				
			||||||
@@ -6,6 +6,6 @@
 | 
				
			|||||||
function(tool_vn_character DEP_NAME IN OUT)
 | 
					function(tool_vn_character DEP_NAME IN OUT)
 | 
				
			||||||
  add_custom_target(${DEP_NAME}
 | 
					  add_custom_target(${DEP_NAME}
 | 
				
			||||||
    COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --assets="${ASSETS_DIR}" --root="${ROOT_DIR}" --in="${IN}" --out="${OUT}"
 | 
					    COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --assets="${ASSETS_DIR}" --root="${ROOT_DIR}" --in="${IN}" --out="${OUT}"
 | 
				
			||||||
    COMMENT "Adding VN Character ${FILE_NAME}"
 | 
					    COMMENT "Adding VN Character ${DEP_NAME}"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
endfunction()
 | 
					endfunction()
 | 
				
			||||||
		Reference in New Issue
	
	Block a user