Line 1... |
Line 1... |
#include "orgfx_plus.h"
|
#include "orgfx_plus.h"
|
#include "orgfx_3d.h"
|
#include "orgfx_3d.h"
|
#include "orgfx.h"
|
#include "orgfx.h"
|
#include "orgfx_bitmap_font.h"
|
|
#include "orgfx_vector_font.h"
|
|
#include <math.h>
|
#include <math.h>
|
|
|
#include "cube.obj.h"
|
#include "man.obj.h"
|
#include "humanoid_tri.obj.h"
|
#include "uv.png.h"
|
#include "Bahamut_cc.png.h"
|
|
#include "interptest.bmp.h"
|
|
|
|
#include "franklin_font.h"
|
|
#include "test_font.h"
|
|
|
|
//#include "stdio.h"
|
//#include "stdio.h"
|
|
|
int main(void)
|
int main(void)
|
{
|
{
|
int i,j;
|
|
|
|
int text[] = {65, 228, 0};
|
|
|
|
// Initialize screen, no double buffering
|
// Initialize screen, no double buffering
|
int screen = orgfxplus_init(640, 480, 16, 1, 0);
|
int screen = orgfxplus_init(640, 480, 16, 1, 1);
|
|
|
int bahamut_sprite = orgfxplus_init_surface(186, 248, Bahamut_cc);
|
// Set up texture and mesh
|
int interp_sprite = orgfxplus_init_surface(10, 10, interptest);
|
int uv_sprite = init_uv_sprite();
|
|
orgfx_mesh man_mesh = init_man_mesh();
|
|
orgfx3d_mesh_texture_size(&man_mesh, 128, 128);
|
|
|
int franklin_surface = orgfxplus_init_surface(512, 512, franklin_img);
|
// Bind the texture
|
orgfx_tileset franklin_ts = orgfx_make_tileset(franklin_surface, franklin_glyphs, 256);
|
orgfxplus_bind_tex0(uv_sprite);
|
orgfx_bitmap_font franklin_font = orgfx_make_bitmap_font(&franklin_ts, 5, 16);
|
|
|
|
// orgfx_mesh mesh = orgfx3d_make_mesh(cube_faces, cube_nfaces, cube_verts, cube_nverts);
|
|
// orgfx_mesh mesh = orgfx3d_make_mesh(humanoid_tri_faces, humanoid_tri_nfaces, humanoid_tri_verts, humanoid_tri_nverts);
|
|
|
|
float rad = 0;
|
float rad = 0;
|
int t = 0;
|
int i;
|
|
|
orgfxplus_colorkey(0xf81f, 1);
|
|
|
|
orgfx_point3 offset = {350, 300, 0};
|
|
orgfx_point3 scale = {10.0, 10.0, 10.0};
|
|
|
|
// orgfxplus_clip(50,50,100,100, 0);
|
|
// orgfx_enable_cliprect(1);
|
|
|
|
|
|
// vector fonts
|
|
orgfx_vector_font font = init_test_font();
|
|
|
|
while(1)
|
while(1)
|
{
|
{
|
/*
|
orgfx_point3 translation = {200, 300, 0};
|
orgfx_point3 rot = {2*rad,rad,3*rad};
|
orgfx_point3 rotation = {M_PI,rad,0};
|
|
orgfx_point3 scale = {100.0, 100.0, 100.0};
|
|
|
mesh.scale = scale;
|
|
mesh.translation = offset;
|
|
mesh.rotation = rot;
|
|
*/
|
|
// Clear screen
|
// Clear screen
|
orgfxplus_fill(0,0,640*FIXEDW,480*FIXEDW,0xffff);
|
orgfxplus_fill(0,0,640*FIXEDW,480*FIXEDW,0xffff);
|
|
|
for(i = 0; i < 5000000; ++i);
|
for(i = 0; i < 5000000; ++i);
|
/*
|
|
orgfx3d_draw_mesh(&mesh, 1, 1);
|
|
|
|
orgfxplus_fill(0,0,100*FIXEDW,100*FIXEDW,0x0000);
|
|
|
|
orgfx_enable_tex0(1);
|
|
orgfxplus_bind_tex0(bahamut_sprite);
|
|
orgfx_uv(0,0,180,0,90,100);
|
|
orgfx_triangle(0,0,100*FIXEDW,0,50*FIXEDW,100*FIXEDW, 1);
|
|
orgfx_enable_tex0(0);
|
|
|
|
orgfx_set_colors(0xf800, 0x07c0, 0x003f);
|
|
orgfx_triangle(0,100*FIXEDW,100*FIXEDW,100*FIXEDW,50*FIXEDW,200*FIXEDW, 1);
|
|
// orgfx_enable_tex0(0);
|
|
orgfx_triangle(100*FIXEDW,0,200*FIXEDW,0,150*FIXEDW,100*FIXEDW, 0);
|
|
|
|
orgfx_curve(200*FIXEDW,0,300*FIXEDW,0,250*FIXEDW,100*FIXEDW,
|
|
0, 1);
|
|
|
|
orgfx_curve(300*FIXEDW,0,400*FIXEDW,0,350*FIXEDW,100*FIXEDW,
|
|
0, 0);
|
|
|
|
orgfxplus_alpha(0x80, 1);
|
|
orgfxplus_draw_surface(100*FIXEDW, 100*FIXEDW, bahamut_sprite);
|
|
orgfxplus_alpha(0xff, 0);
|
|
// orgfx_enable_tex0(0);
|
|
|
|
orgfx_put_text(&font, 10*FIXEDW, 200*FIXEDW, "some EXAMPLE text");
|
|
*/
|
|
|
|
orgfx_put_bitmap_text(&franklin_font, 10*FIXEDW, 200*FIXEDW, L"some ÅXÖMBLÄ text");
|
|
|
|
orgfx_vf_write(&font , L"some ÅXÖMBLÄ text", 10, 250, 0x0000);
|
|
// draw interp-test
|
|
orgfx_enable_tex0(1);
|
|
orgfxplus_bind_tex0(interp_sprite);
|
|
orgfx_uv(0,0,10,0,0,10);
|
|
orgfx_triangle(0,0,200*FIXEDW,0,0*FIXEDW,200*FIXEDW, 1);
|
|
orgfx_uv(10,0,10,10,0,10);
|
|
orgfx_triangle(200*FIXEDW,0*FIXEDW,200*FIXEDW,200*FIXEDW,0*FIXEDW,200*FIXEDW, 1);
|
|
orgfx_enable_tex0(0);
|
|
|
|
orgfx_set_color(0xf800);
|
// Clear the depth buffer
|
//orgfx_line(0,0,200*FIXEDW,200*FIXEDW);
|
orgfx_clear_zbuffer();
|
|
orgfx_enable_zbuffer(1);
|
|
|
|
// Draw wireframe
|
|
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 0, 0);
|
|
translation.x += 150;
|
|
|
|
// Draw filled
|
|
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 1, 0);
|
|
translation.x += 150;
|
|
|
|
// Draw textured
|
|
orgfx3d_draw_mesh(&man_mesh, translation, rotation, scale, 1, 1);
|
|
orgfx_enable_zbuffer(0);
|
|
|
t += 5;
|
// Rotate meshes
|
rad += 0.01;
|
rad += 0.01;
|
if(rad >= M_PI*2) rad -= M_PI*2;
|
if(rad >= M_PI*2) rad -= M_PI*2;
|
|
|
// Swap buffers
|
// Swap buffers
|
orgfxplus_flip();
|
orgfxplus_flip();
|