branches/micko/src/emu/guiengine.c
r23975 | r23976 | |
72 | 72 | { |
73 | 73 | private: |
74 | 74 | // internal state |
75 | | running_machine & m_machine; // reference to our machine |
76 | | |
| 75 | running_machine & m_machine; // reference to our machine |
| 76 | |
77 | 77 | public: |
78 | 78 | ShellRenderInterfaceSystem(running_machine &machine) |
79 | 79 | : m_machine(machine) |
r23975 | r23976 | |
86 | 86 | /// Called by Rocket when it wants to render geometry that it does not wish to optimise. |
87 | 87 | virtual void RenderGeometry(Rocket::Core::Vertex* vertices, int num_vertices, int* indices, int num_indices, Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation) |
88 | 88 | { |
| 89 | |
89 | 90 | for (int i = 0; i < num_indices/3; i++) |
90 | | { |
91 | | machine().render().ui_container().add_line((vertices[indices[i*3+0]].position.x+translation.x)/1024,(vertices[indices[i*3+0]].position.y+translation.y)/768, (vertices[indices[i*3+1]].position.x+translation.x)/1024,(vertices[indices[i*3+1]].position.y+translation.y)/768, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
92 | | machine().render().ui_container().add_line((vertices[indices[i*3+1]].position.x+translation.x)/1024,(vertices[indices[i*3+1]].position.y+translation.y)/768, (vertices[indices[i*3+2]].position.x+translation.x)/1024,(vertices[indices[i*3+2]].position.y+translation.y)/768, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
93 | | machine().render().ui_container().add_line((vertices[indices[i*3+2]].position.x+translation.x)/1024,(vertices[indices[i*3+2]].position.y+translation.y)/768, (vertices[indices[i*3+0]].position.x+translation.x)/1024,(vertices[indices[i*3+0]].position.y+translation.y)/768, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 91 | { |
| 92 | /*render_texture *hilight_texture = machine().render().texture_alloc(); |
| 93 | rectangle myrect = ((bitmap_rgb32 *)texture)->cliprect(); |
| 94 | printf("%f, %f\n",myrect.max_x * vertices[indices[i*3+0]].tex_coord[0],myrect.max_y * vertices[indices[i*3+0]].tex_coord[1]); |
| 95 | myrect.min_x = myrect.max_x * vertices[indices[i*3+0]].tex_coord[0]; |
| 96 | myrect.min_y = myrect.max_y * vertices[indices[i*3+0]].tex_coord[1]; |
| 97 | hilight_texture->set_bitmap(*((bitmap_rgb32 *)texture), myrect, TEXFORMAT_ARGB32); |
| 98 | */ |
| 99 | rgb_t col1 = MAKE_ARGB(vertices[i].colour.alpha, vertices[indices[i*3+0]].colour.red, vertices[indices[i*3+0]].colour.green, vertices[indices[i*3+0]].colour.blue); |
| 100 | rgb_t col2 = MAKE_ARGB(vertices[i].colour.alpha, vertices[indices[i*3+0]].colour.red, vertices[indices[i*3+0]].colour.green, vertices[indices[i*3+0]].colour.blue); |
| 101 | rgb_t col3 = MAKE_ARGB(vertices[i].colour.alpha, vertices[indices[i*3+0]].colour.red, vertices[indices[i*3+0]].colour.green, vertices[indices[i*3+0]].colour.blue); |
| 102 | machine().render().ui_container().add_line((vertices[indices[i*3+0]].position.x+translation.x)/1024,(vertices[indices[i*3+0]].position.y+translation.y)/768, (vertices[indices[i*3+1]].position.x+translation.x)/1024,(vertices[indices[i*3+1]].position.y+translation.y)/768, UI_LINE_WIDTH, col1, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 103 | machine().render().ui_container().add_line((vertices[indices[i*3+1]].position.x+translation.x)/1024,(vertices[indices[i*3+1]].position.y+translation.y)/768, (vertices[indices[i*3+2]].position.x+translation.x)/1024,(vertices[indices[i*3+2]].position.y+translation.y)/768, UI_LINE_WIDTH, col2, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
| 104 | machine().render().ui_container().add_line((vertices[indices[i*3+2]].position.x+translation.x)/1024,(vertices[indices[i*3+2]].position.y+translation.y)/768, (vertices[indices[i*3+0]].position.x+translation.x)/1024,(vertices[indices[i*3+0]].position.y+translation.y)/768, UI_LINE_WIDTH, col3, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
94 | 105 | |
| 106 | //machine().render().ui_container().add_quad((vertices[indices[i*3+0]].position.x+translation.x)/1024,(vertices[indices[i*3+0]].position.y+translation.y)/768, (vertices[indices[i*3+1]].position.x+translation.x)/1024,(vertices[indices[i*3+2]].position.y+translation.y)/768, UI_BORDER_COLOR, hilight_texture,PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); |
95 | 107 | } |
| 108 | //machine().render().texture_free(hilight_texture); |
96 | 109 | } |
97 | 110 | |
98 | 111 | /// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future. |
r23975 | r23976 | |
214 | 227 | /// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels. |
215 | 228 | virtual bool GenerateTexture(Rocket::Core::TextureHandle& texture_handle, const Rocket::Core::byte* source, const Rocket::Core::Vector2i& source_dimensions) |
216 | 229 | { |
| 230 | /* create a texture for hilighting items */ |
| 231 | bitmap_rgb32 *hilight_bitmap = auto_bitmap_rgb32_alloc(machine(), source_dimensions.x, source_dimensions.y); |
| 232 | for (int y = 0; y < source_dimensions.y; ++y) |
| 233 | { |
| 234 | for (int x = 0; x < source_dimensions.x; ++x) |
| 235 | { |
| 236 | const Rocket::Core::byte* source_pixel = source + (source_dimensions.x * 4 * y) + (x * 4); |
| 237 | hilight_bitmap->pix32(y, x) = MAKE_ARGB(source_pixel[3],source_pixel[0],source_pixel[1],source_pixel[2]); |
| 238 | } |
| 239 | } |
| 240 | //render_texture *hilight_texture = machine().render().texture_alloc(); |
| 241 | //hilight_texture->set_bitmap(*hilight_bitmap, hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); |
| 242 | //texture_handle = (Rocket::Core::TextureHandle)hilight_texture; |
| 243 | texture_handle = (Rocket::Core::TextureHandle)hilight_bitmap; |
217 | 244 | return true; |
218 | 245 | } |
219 | 246 | /// Called by Rocket when a loaded texture is no longer required. |
220 | 247 | virtual void ReleaseTexture(Rocket::Core::TextureHandle texture_handle) |
221 | 248 | { |
| 249 | //machine().render().texture_free((render_texture *)texture_handle); |
222 | 250 | } |
223 | 251 | }; |
224 | 252 | |