Beispiel #1
0
void	tektext_part(t_bunny_pixelarray	*out,
		     const char		*str,
		     t_font		*font,
		     t_bunny_position	*pos)
{
  int			i;
  int			limit = 0;
  t_bunny_position	bis;

  limit = getletter();
  bis.x = pos->x;
  bis.y = pos->y;
  i = 0;
  while (str[i] != '\0' && i < limit)
    {
      if (str[i] == '\n')
	{
	  bis.x = pos->x;
	  bis.y += font->letter.y * font->scale + 1;;
	}
      else
	{
	  draw_letter(out, font, str[i], &bis);
	  bis.x += font->letter.x * font->scale + 1;
	}
      ++i;
    }
}
Beispiel #2
0
int main(int argc, char* argv[]) {
  win_new();

  glfwSetWindowTitle("font_perf");
//  font_set_color(1, 1, 1, 0);

	perf_init();

  // main loop
  glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
  while(1) {
		perf_mark_beg("glClear");
    glClear(GL_COLOR_BUFFER_BIT);
		perf_mark_end("glClear");

		perf_mark_beg("ortho");
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    int l = 0;
    int r = win_width();
    int b = 0;
    int t = win_height();
    gluOrtho2D(l, r, b, t);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
		perf_mark_end("ortho");


     // draw bitmap letter
//		perf_mark_beg("draw_letter");
//		int i;
//		for(i = 0; i < 50; ++i) {
    	draw_letter();
//		}
//		perf_mark_end("draw_letter");

//    font_draw(100, 100, "bitchin camaro!");

		perf_mark_beg("swap");
    glfwSwapBuffers();
		perf_mark_end("swap");
    if(!glfwGetWindowParam(GLFW_OPENED))
      break;

//    fps_inc_frames_drawn();
	  perf_report();
  }

	perf_terminate();
  glfwTerminate();
  return 0;
}
Beispiel #3
0
void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int smalltext, int image_width, int image_height)
{
	/* Plot a string into the pixel buffer */
	int i, string_length, string_left_hand;

	string_length = strlen(input_string);
	string_left_hand = xposn - ((7 * string_length) / 2);

	for(i = 0; i < string_length; i++) {
		draw_letter(pixbuf, input_string[i], string_left_hand + (i * 7), yposn, smalltext, image_width, image_height);
	}

}
Beispiel #4
0
void draw_font_letter (char c, bool is_fill) {
  draw_letter(letters[c], white, white, is_fill);
}