def set_back_side_symbol(self, symbol): """ Sets the given symbol in large on the back side of this hexagon. """ self.back_side_text.node().setText(str(symbol)) y = self.back_side_text.getY() center_node_on_xyz(self.back_side_text, 0, 0, 0) self.back_side_text.setY(y) self.back_side_text.setZ(self.back_side_text_z)
def _create_text_fields(self, radius, width): test_letter = 'W' # the larger back side text field x, z = 0, 0 y = (width / 2.0 + Hexagon.text_distance) text = TextNode('') #font = loader.loadFont("cmss12.egg") #text.setFont(font) text.setGlyphScale(1.1 * radius) text.setTextColor(0, 0, 0, 1) self.back_side_text = self.root_node_path.attachNewNode(text) self.back_side_text.node().setText(test_letter) self.back_side_text.setH(180) center_node_on_xyz(self.back_side_text, x, y, z) self.back_side_text_z = self.back_side_text.getZ() # the six front side text fields self.front_side_text_coordinates = [] for _i, phi in enumerate(range(0, 360, 60)): text = TextNode('') #text.setFont(font) text.setGlyphScale(0.45 * radius) text.setTextColor(0, 0, 0, 1) text_path = self.root_node_path.attachNewNode(text) self.front_side_text.append(text_path) x, z = rotate_phi_degrees_clockwise(phi, (0, radius / 1.6)) text_path.node().setText(test_letter) center_node_on_xyz(text_path, x, -y, z) self.front_side_text_coordinates.append((x, -y, z))
def _create_text_fields(self, radius, width): test_letter = 'W' # the larger back side text field x,z = 0,0 y = (width/2.0+Hexagon.text_distance) text = TextNode('') #font = loader.loadFont("cmss12.egg") #text.setFont(font) text.setGlyphScale(1.1*radius) text.setTextColor(0,0,0,1) self.back_side_text = self.root_node_path.attachNewNode(text) self.back_side_text.node().setText(test_letter) self.back_side_text.setH(180) center_node_on_xyz(self.back_side_text, x, y, z) self.back_side_text_z = self.back_side_text.getZ() # the six front side text fields self.front_side_text_coordinates = [] for _i, phi in enumerate(range(0,360,60)): text = TextNode('') #text.setFont(font) text.setGlyphScale(0.45*radius) text.setTextColor(0,0,0,1) text_path = self.root_node_path.attachNewNode(text) self.front_side_text.append(text_path) x,z = rotate_phi_degrees_clockwise(phi, (0,radius/1.6)) text_path.node().setText(test_letter) center_node_on_xyz(text_path, x, -y, z) self.front_side_text_coordinates.append((x,-y,z))
def set_front_side_symbol(self, idx, symbol): """ Sets the given symbol on the front side of the hexagon. Idx must be smaller than 5 and determines the reachability of the symbol, which depends on the hex_index, i.e. the position, of this hexagon. Idx=0 positions the symbol at the best reachable position, pos=4 puts the symbol at worst reachable position. """ if idx > 4: return pos = self.idx_to_pos[idx] self.front_side_text[pos].node().setText(str(symbol)) x, y, z = self.front_side_text_coordinates[pos] center_node_on_xyz(self.front_side_text[pos], x, y, z)
def set_front_side_symbol(self, idx, symbol): """ Sets the given symbol on the front side of the hexagon. Idx must be smaller than 5 and determines the reachability of the symbol, which depends on the hex_index, i.e. the position, of this hexagon. Idx=0 positions the symbol at the best reachable position, pos=4 puts the symbol at worst reachable position. """ if idx > 4: return pos = self.idx_to_pos[idx] self.front_side_text[pos].node().setText(str(symbol)) x,y,z = self.front_side_text_coordinates[pos] center_node_on_xyz(self.front_side_text[pos], x, y, z)