This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »
1816
Function Peer Review / GML: draw_sprite_tiled + draw_sprite_tiled_ext
« on: September 25, 2010, 11:05:31 am »
Notice: These functions work with any sprite size, but the functionality in _ext differs from GM one. The difference is with scaling. x and y arguments, according to manual, is "(x,y) is the place where one of the sprites is drawn". In GM these arguments are modified with scaling, so, for example, when you have a 100x100 sprite, you tile it with 0.5 scale, and put 25 in x and y position, then you won't have a sprite drawn in 25,25 as manual suggests, but you will have one drawn at 12.5,12.5. In this code this it will be drawn in 25,25. This can be changed with two parenthesis, but I think this is how the function needed to work in the first place.
Function: draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.h:
GSsprite.cpp:
Function:draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.h:
GSsprite.cpp:
In attachments you can see two images.
First one is: draw_sprite_tiled(spr_0,0,50,50);
Other one is: draw_sprite_tiled_ext(spr_0,0,25,25,0.5,0.5,c_yellow,0.5);
Function: draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.h:
Code: [Select]
int draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.cpp:
Code: [Select]
int draw_sprite_tiled(int spr,int subimg,double x,double y)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glPushAttrib(GL_CURRENT_BIT);
glColor4f(1,1,1,1);
const float tbx=spr2d->texbordx,tby=spr2d->texbordy,
xoff=spr2d->xoffset+x,
yoff=spr2d->yoffset+y;
const int hortil= int (ceil(room_width/(spr2d->width*tbx))),
vertil= int (ceil(room_height/(spr2d->height*tby)));
glBegin(GL_QUADS);
for (int i=0; i<hortil; i++){
for (int c=0; c<vertil; c++){
glTexCoord2f(0,0);
glVertex2f(i*spr2d->width-xoff,c*spr2d->height-yoff);
glTexCoord2f(tbx,0);
glVertex2f((i+1)*spr2d->width-xoff,c*spr2d->height-yoff);
glTexCoord2f(tbx,tby);
glVertex2f((i+1)*spr2d->width-xoff,(c+1)*spr2d->height-yoff);
glTexCoord2f(0,tby);
glVertex2f(i*spr2d->width-xoff,(c+1)*spr2d->height-yoff);
}
}
glEnd();
glPopAttrib();
return 0;
}
Function:draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.h:
Code: [Select]
int draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.cpp:
Code: [Select]
int draw_sprite_tiled_ext(int spr,int subimg,double x,double y, double xscale,double yscale,int color,double alpha)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glPushAttrib(GL_CURRENT_BIT);
glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255));
const float tbx=spr2d->texbordx,tby=spr2d->texbordy,
xoff=spr2d->xoffset*xscale+x,
yoff=spr2d->yoffset*yscale+y;
const int hortil= int (ceil(room_width/(spr2d->width*tbx*xscale))),
vertil= int (ceil(room_height/(spr2d->height*tby*yscale)));
glBegin(GL_QUADS);
for (int i=0; i<hortil; i++){
for (int c=0; c<vertil; c++){
glTexCoord2f(0,0);
glVertex2f(i*spr2d->width*xscale-xoff,c*spr2d->height*yscale-yoff);
glTexCoord2f(tbx,0);
glVertex2f((i+1)*spr2d->width*xscale-xoff,c*spr2d->height*yscale-yoff);
glTexCoord2f(tbx,tby);
glVertex2f((i+1)*spr2d->width*xscale-xoff,(c+1)*spr2d->height*yscale-yoff);
glTexCoord2f(0,tby);
glVertex2f(i*spr2d->width*xscale-xoff,(c+1)*spr2d->height*yscale-yoff);
}
}
glEnd();
glPopAttrib();
return 0;
}
In attachments you can see two images.
First one is: draw_sprite_tiled(spr_0,0,50,50);
Other one is: draw_sprite_tiled_ext(spr_0,0,25,25,0.5,0.5,c_yellow,0.5);
1817
Function Peer Review / Re: Function Peer Review Board
« on: September 25, 2010, 10:20:58 am »
Can I somehow output to the console from the exe? I just want some good way to debug functions I make. Its hard when I don't have any way to output that information.
So the question is, can I somehow use something like print or printf to output to console?
So the question is, can I somehow use something like print or printf to output to console?
1818
Proposals / Re: LGM themes
« on: September 18, 2010, 09:38:49 am »
I actually like first two themes over the current LGM one. Maybe just because I am used to GM and its colors, but I do like the Window'y style and colors of the first one.
1819
Announcements / Re: What's happening now
« on: September 13, 2010, 11:56:27 am »
Is basic backgrounds included? I just want to make all of the background functions (if you don't want too), and that will make porting from GM almost possible. Then fonts, surfaces and thats it. I for one don't use paths or timelines so I don't care about those.
1820
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext (unfinished)
« on: September 11, 2010, 12:52:32 pm »
All other sprite functions use the same for alpha. But anyway, as this method doesn't really work, and as this function is almost never used, then I don't see any reason to continue this. I will wait until Josh creates framework for backgrounds and then I will add functions for that.
1821
Announcements / Re: ENIGMA R4
« on: September 11, 2010, 04:07:17 am »
So... I still get "update to ..." problem. Every time I do it, it just asks me again.
1822
Function Peer Review / Re: GML: draw_sprite_tiled + draw_sprite_tiled_ext (unfinished)
« on: September 10, 2010, 02:30:46 pm »
Ou I see. Didn't check for non ^2 sprites. Actually, I did want to make this function in another way (which is a lot slower, that is why in the end I did this). The slower way would be to just draw individual textures in a for loop (two for loops, or repeat or whatever). Thou this would just be like doing it the same in LGM with draw_sprite, so I guess its redundant. Anyway, I will look into backgrounds when all of the basic framework is there.
1823
Function Peer Review / GML: draw_sprite_tiled + draw_sprite_tiled_ext (works only with power of two)
« on: September 10, 2010, 05:59:44 am »
Notice: These functions work only with power of two textures (sprites), so this implementation is kind of limited. Also, it will only draw a tiled region with width/height the length of min(room_width,room_height). This is OpenGL limitation. Still, this could be used for something, and I think tiling power of two images this way is much faster than the other way (http://enigma-dev.org/forums/index.php?topic=641.0), but that way doesn't have any limitations.
Function: draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.h:
GSsprite.cpp:
Function:draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.h:
GSsprite.cpp:
TO-DO:
1) Make both functions work in views (now they use room size)
2) Tile the tiled images. Now it draws as a square which has side as min(room_width, room_height). Maybe someone more profound in C++ could help with this.
Function: draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.h:
Code: [Select]
int draw_sprite_tiled(int spr,int subimg,double x,double y);
GSsprite.cpp:
Code: [Select]
int draw_sprite_tiled(int spr,int subimg,double x,double y)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glPushAttrib(GL_CURRENT_BIT);
glColor4f(1,1,1,1);
const float tbx=spr2d->texbordx,tby=spr2d->texbordy,
vertil=room_width/spr2d->width,
hortil=room_height/spr2d->height,
xoff=spr2d->xoffset/spr2d->width+x/spr2d->width,
yoff=spr2d->yoffset/spr2d->height+y/spr2d->height;
glBegin(GL_QUADS);
glTexCoord2f(xoff,yoff);
glVertex2f(0,0);
glTexCoord2f(hortil*tbx+xoff,yoff);
glVertex2f(spr2d->width*hortil,0);
glTexCoord2f(hortil*tbx+xoff,vertil*tby+yoff);
glVertex2f(spr2d->width*hortil,spr2d->height*vertil);
glTexCoord2f(xoff,vertil*tby+yoff);
glVertex2f(0,spr2d->height*vertil);
glEnd();
glPopAttrib();
return 0;
}
Function:draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.h:
Code: [Select]
int draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int color,double alpha);
GSsprite.cpp:
Code: [Select]
int draw_sprite_tiled_ext(int spr,int subimg,double x,double y,double xscale,double yscale,int blend,double alpha)
{
enigma::sprite *spr2d = enigma::spritestructarray[spr];
if (!spr2d)
return -1;
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve != spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve = spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glPushAttrib(GL_CURRENT_BIT);
//glColor4f(1,1,1,1);
glColor4ub(__GETR(blend),__GETG(blend),__GETB(blend),char(alpha*255));
const float tbx=spr2d->texbordx,tby=spr2d->texbordy,
vertil=room_width/(spr2d->width*xscale),
hortil=room_height/(spr2d->height*yscale),
xoff=spr2d->xoffset/(spr2d->width*xscale)+x/(spr2d->width*xscale),
yoff=spr2d->yoffset/(spr2d->height*yscale)+y/(spr2d->height*yscale);
glBegin(GL_QUADS);
glTexCoord2f(xoff,yoff);
glVertex2f(0,0);
glTexCoord2f(hortil*tbx+xoff,yoff);
glVertex2f(spr2d->width*xscale*hortil,0);
glTexCoord2f(hortil*tbx+xoff,vertil*tby+yoff);
glVertex2f(spr2d->width*xscale*hortil,spr2d->height*yscale*vertil);
glTexCoord2f(xoff,vertil*tby+yoff);
glVertex2f(0,spr2d->height*yscale*vertil);
glEnd();
glPopAttrib();
return 0;
}
TO-DO:
1) Make both functions work in views (now they use room size)
2) Tile the tiled images. Now it draws as a square which has side as min(room_width, room_height). Maybe someone more profound in C++ could help with this.
1824
Function Peer Review / Re: Instance Interface How-to
« on: September 10, 2010, 04:31:47 am »
Something like enigme:room_width? Because room_width isn't declared in the functions scope and it trows an error.
edit: Nevermind. extern int room_width, room_height; fixed it.
Also, I know that backgroundstruct.h exists, but there are no GSbackground.h and .cpp files, so can I try to create them so I can make some background functions? Or is it better for me to wait a little so you can make them in the distribution?
edit: Nevermind. extern int room_width, room_height; fixed it.
Also, I know that backgroundstruct.h exists, but there are no GSbackground.h and .cpp files, so can I try to create them so I can make some background functions? Or is it better for me to wait a little so you can make them in the distribution?
1825
Function Peer Review / Re: draw_sprite_stretched_ext
« on: September 10, 2010, 04:20:25 am »
Yes, it works. I will make others now.
1826
Function Peer Review / Re: Instance Interface How-to
« on: September 09, 2010, 03:52:48 pm »
How to interface with rooms? I am trying to make sprite_tiled, but I need to know room_width/room_height, or even better would be view_width and view_height, as that would make sprites tile only in view, and thus eliminate call when outside the screen.
I tried including roomsystem.h and then just use room_width and room_height, but it trows:
I tried including roomsystem.h and then just use room_width and room_height, but it trows:
Quote
../../Universal_System/roomsystem.h:46: error: `string' does not name a typeSo I guess its not what I want to include? I saw that there are file like GMinstance.h and another file instance.h, which looks similar in function, so are some files redundant?
../../Universal_System/roomsystem.h:85: error: `string' does not name a type
../../Universal_System/roomsystem.h:86: error: `string' does not name a type
1827
Function Peer Review / GML: draw_sprite_stretched_ext
« on: September 09, 2010, 02:11:31 pm »
If I understand the point of this section correctly, then we can add function code here? If so, then I will start by implementing simple, but missing additions.
edit: Removed unneeded glColor4f function.
Function: draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha)
GSSprite.h:
GSSprite.cpp:
If this is how should these topics look like, then I will do others too.
edit: Removed unneeded glColor4f function.
Function: draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha)
GSSprite.h:
Code: [Select]
int draw_sprite_stretched_ext(int sprite,int subimg,double x,double y,double w,double h,int color,double alpha);
GSSprite.cpp:
Code: [Select]
int draw_sprite_stretched_ext(int spr,int subimg,double x,double y,double w,double h, int blend, double alpha)
{
enigma::sprite *spr2d=enigma::spritestructarray[spr];
if (!spr2d)
return -1;
glPushAttrib(GL_CURRENT_BIT);
if (enigma::cur_bou_tha_noo_sho_eve_cha_eve!=spr2d->texturearray[subimg % spr2d->subcount])
{
glBindTexture(GL_TEXTURE_2D,spr2d->texturearray[subimg % spr2d->subcount]);
enigma::cur_bou_tha_noo_sho_eve_cha_eve=spr2d->texturearray[subimg % spr2d->subcount];
}
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glBegin(GL_QUADS);
glColor4ub(__GETR(blend),__GETG(blend),__GETB(blend),char(alpha*255)); //Implement "blend" parameter
glTexCoord2f(spr2d->texbordx,0);
glVertex2f(x-spr2d->xoffset,y-spr2d->yoffset);
glTexCoord2f(0,0);
glVertex2f(x+w-spr2d->xoffset,y-spr2d->yoffset);
glTexCoord2f(0,spr2d->texbordy);
glVertex2f(x+w-spr2d->xoffset,y+h-spr2d->yoffset);
glTexCoord2f(spr2d->texbordx,spr2d->texbordy);
glVertex2f(x-spr2d->xoffset,y+h-spr2d->yoffset);
glEnd();
glPopAttrib();
return 0;
}
If this is how should these topics look like, then I will do others too.
1828
Issues Help Desk / Re: Common Incompatibilities
« on: September 09, 2010, 09:03:41 am »
Actually repeat crashes on me too. I wanted to report that, but I thought it just wasn't implemented. I just created one object, put "repeat (5) {}" in step event, and put the object in the room. And it crashes LGM with:
Quote
Event[3]: Parsing 1 sub-events:
Check "obj::step...Done. Starting parse..."
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
poof.
poof.
poof.
1829
Issues Help Desk / Re: Common Incompatibilities
« on: September 09, 2010, 06:54:53 am »
You can see all of the implemented functions inside enigma and also here: http://enigma-dev.org/functions.htm. Function development wasn't the priority in the last stage of development, thou in light of the R4 release function development could speed up. Most of the functions aren't even hard to implement, it just wasn't done.
1830
Announcements / Re: ENIGMA R4
« on: September 08, 2010, 09:01:50 am »Quote
Whats your OS ?Win7 64bit.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »