Game_Re_creation_Project
Member
I can't quite find the answer I'm looking for in the forums.
I am looking for a method to rotate a set of 2d vertices about the object's current origin. Is there a way to do this without using a matrix? (Or even a surface...)
Create:
Draw:
I assume I would have to run a begin_ and end_step event and check my current rotation to a previous rotation. If there is a change, I would have to unfreeze the vertices and redraw and then re-freeze. That would be the easy part. I'm just wondering if there is some fancy built-in function that would already do this, like vertex_submit_ext(v_buff, pr_trianglelist, -1, current_rotation) or something to that effect.
Would using a matrix cause slowdowns if I only need the vertices in 2d space? This is supposed to be a drawn scrollbar that the user can click on and perform different operations depending on where it is clicked. I figured it would be better to "draw" the scrollbar rather than use sprites as I want this to work with multiple resolutions. My goal is to create a series of user controls similar to what you would find in most handles for windows device controls (HWND) objects.
Any suggestions would be helpful.
I am looking for a method to rotate a set of 2d vertices about the object's current origin. Is there a way to do this without using a matrix? (Or even a surface...)
Create:
GML:
vertex_format_begin();
vertex_format_add_position();
vertex_format_add_color();
v_format = vertex_format_end();
v_buff = vertex_create_buffer();
var currBuffer, currTexture;
currBuffer = v_buff;
currTexture = texture_to_use;
vertex_begin(currBuffer,v_format);
vertex_position(currBuffer,scrollbar_x1+(scrollbar_width*0),scrollbar_y1);
vertex_color(currBuffer,c_dkgray,1.0);
vertex_position(currBuffer,scrollbar_x1+(scrollbar_width*0),scrollbar_y2);
vertex_color(currBuffer,c_dkgray,1.0);
vertex_position(currBuffer,scrollbar_x2+(scrollbar_width*0),scrollbar_y2);
vertex_color(currBuffer,c_dkgray,1.0);
vertex_position(currBuffer,scrollbar_x1+(scrollbar_width*0),scrollbar_y1);
vertex_color(currBuffer,c_dkgray,1.0);
vertex_position(currBuffer,scrollbar_x2+(scrollbar_width*0),scrollbar_y2);
vertex_color(currBuffer,c_dkgray,1.0);
vertex_position(currBuffer,scrollbar_x2+(scrollbar_width*0),scrollbar_y1);
vertex_color(currBuffer,c_dkgray,1.0);
v_buff = currBuffer;
vertex_end(v_buff);
vertex_freeze(v_buff);
Code:
vertex_submit(v_buff, pr_trianglelist, -1);
Would using a matrix cause slowdowns if I only need the vertices in 2d space? This is supposed to be a drawn scrollbar that the user can click on and perform different operations depending on where it is clicked. I figured it would be better to "draw" the scrollbar rather than use sprites as I want this to work with multiple resolutions. My goal is to create a series of user controls similar to what you would find in most handles for windows device controls (HWND) objects.
Any suggestions would be helpful.
Last edited: