| |
| |
| |
|
Page: 1 2 3 4 5 6 7
Comments:
<0> maybe i could use a function pointer to a "render" and a "menus" function <0> that would work <0> would be more optimal than my previous way <0> is there a linux equivalent of windows Sleep() ? <1> there is the sdl sleep <1> will that work ? <0> probably <2> what's the precision of windows sleep? There is usleep, but it suspends a number of microseconds..but if you do use SDL, using SDL_Delay is much better <0> SDl_Sleep() ? <0> oh ok <0> Sleep() sleeps by milliseconds <1> but its not exact' <0> its precise but not accurate <0> ;) <1> what are you sleeping for ? is this a timed app ? <2> mattmatteh: SDL_Delay afaik just used Sleep on windows anyways, so it won't give any different results there =P
<1> RaYmAn-Bx, oh. what is it on linux ? <2> not sure <0> it'll still work just fine <0> as long as its cross platform <0> i'm sleeping between rendering each frame <0> beacuse its tetris you don't need to render at 80 fps <1> ChrOnX, what is the frame rate ? <0> so i sleep 50 milliseconds at least between each frame <0> idk what the framerate is lol <0> never figured out how to calulate it <1> ChrOnX, sleep usually doesnt work well for that. i am using it now but my app is still in dev stages. and i also take into account the time spent on the app and the time actually slept <1> like mine is 60 frame / sec <0> well if i let it run fullspeed it takes 100% cpu <1> ChrOnX, does your app use sound ? <0> yes <0> sound effects not music <0> but i'm hoping sdl will let me use music as well <0> because directSound is difficult to use <0> i never figured it out exactly <0> never spent much time on it either o_O <1> oh thats different. i havent done this myself, but here the sound call back is a good timer <1> ChrOnX, well, what determines the frame rate ? <1> ChrOnX, each time a block moves ? <0> frame rate is determined by your pc <0> i don't have it limited in any way except i make it pause 5 milliseconds between each frame <1> ChrOnX, you said this was teris ? <0> yes <1> then what changes on the screen ? <0> block moving <0> and rotating <0> which is user controlled <1> each peice as it moves down right ? <0> you're forgetting about block rotation <0> its user controlled <0> so the user wants to see the block turn as soon as they press rotate <1> i wouldnt do a frame rate at all. only update when there is a change. the block speed can be a sleep or on a timer ( experiment with that, over time it will be way off i think), or if the player rotates the peice, then update. <1> timer might work, but not sure. <0> hmmm.. <1> might have to experiment with that <0> i could call render() only when the block moves or when user rotates.. <1> thats what i would look into <0> that would save alot on rendering <0> right now i have render() in a while loop <1> so it could be rendering the same stuff ? <1> when it doesnt need to ? <0> but thats becaquse it was part of windows message loop <0> i'll try to recode it so the screen only updates when the user does somthing that requires an update <1> ChrOnX, i would have the message loop all event driven. <0> how would you do that ? <1> ChrOnX, and add a timer. on a timer event, move the peice down. each level, change the timer's delay time. then for rotating the peice, have that in an events key press or something. or key map or something <0> you're thinking like a VB coder lol <1> ChrOnX, VB ? <0> visual basic <0> aka vblows <1> ChrOnX, i havent messed with that in over 5 years, or any M$ product for that matter <1> M$ free here <0> how would you detect key presses ? <0> in linux <1> ChrOnX, look at the event loops. on the sdl wiki. there is the wait event <1> the key press event in sdl <0> link? to the wiki plz
<1> key up and key down <3> libsdl.org/docwiki.cgi/, IIRC. <1> http://www.libsdl.org/cgi/docwiki.cgi/ <3> Close enough. <1> http://www.libsdl.org/cgi/docwiki.cgi/SDL_20API <1> ChrOnX, http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fWaitEvent <1> ChrOnX, http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fAddTimer <3> SDL_PollEvent doesn't block. <1> Tuxiscool, wait event does right ? <3> Ya, it waits until there is an event. <1> thought i stated that wrong. <0> how do i check for keypresses ? <0> pollevent it is <1> http://www.libsdl.org/cgi/docwiki.cgi/SDL_20Event_20Structures <3> Something like this: <3> SDL_Event event; /* ... */ while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: /* Do foo. */ break; }} <1> ChrOnX, i can pm you a short code segment from one of my apps ? <0> yes <0> thanks Tuxiscool <3> np. <0> its just like a windows message loop :D <0> mattmatteh are you registered ? <0> you can't pm if you're not <1> i am but didnt register now <1> ChrOnX, did you get it ? <0> not that i nkow of ? <0> did you msg it ? <1> yes <0> i didn't get it <0> :( <0> maybe i'm not identified <0> i am now. <0> try again ? <0> wait are you gettin my pm's ? <4> Does anyone know a good 2d drawing api for opengl that would allow me to develop an application that runs on more than one display? <4> Using 2 SDL full screen windows seems to do terrible things to the latency. <3> That's dependant on your drivers more than anything. <4> is there a particular videocard/driver pair that is friendly? I've tried matrox and ATI, both the free on proprietary drivers. <0> how do i check if say.. the s key is pressed ? <0> some event member right ? <3> Uint8 *keystate = SDL_GetKeyState(NULL); if ( keystate[SDLK_RETURN] ) printf("Return Key Pressed."); <0> but what about in like an event loop <5> puh <5> can't you just check the examples for a change ? <6> re <0> SDL_Events events; SDL_PollEvents(&events); <0> they don't help -.- <3> event.key.keysym.sym <5> you are just being lazy <3> And you can use SDL_GetKeyState in an event loop. <0> if i use SDL_GetKeyState. where is keystate[] defined ? <0> ohh sry. <0> i get it now <0> what is uint8 ? <3> Uint8, I hope? <0> i've never heard of that type before <3> It's defined in the SDL headers. <0> as ? <0> is it a typedef? <3> 'course. <3> Look it up. <0> k <0> why are types like char int and long typedef'd ? <0> and i'm ***uming the number is the amount of bits ? <3> To the second question, yes. <0> but its not the same for all os's <0> sizeof(int) isn't the same on all os's and pc's <3> Well of course. <0> ? <0> not every int is going to be 32 bits <3> sizeof(char) *is* guaranteed to be at least 8 bits, though. <0> thats because its the smallest <3> I know... <0> every type has to be at least 1 byte
Return to
#sdl or Go to some related
logs:
#xine rpm denyhost fedora #mysql unbutu kismet IUSE_ +fedora core +lvm mirror
CanvasPathDef Invalid gtype device st0 ubuntu udev sodipodi gentoo Laying out /etc/preload
|
|