trying to write code to clear the screen to an arbitrary colour, pretty basic stuff i know but im a bit rusty and could do with some assistance, could possibly use a DWORD if thats any help.
trying to write code to clear the screen to an arbitrary colour, pretty basic stuff i know but im a bit rusty and could do with some assistance, could possibly use a DWORD if thats any help.
Clear screen for what mode, OS, environment, etc?
Console? Win32 API? DOS? DirectX? OpenGL?
for the random can use something like:
but before attend to bubba's observationCode:srand((unsigned)time(0)); int rd,gd,bd; char rh[3],gh[3],bh[3]; rd=rand()%255; gd=rand()%255; bd=rand()%255; sprintf(rh,"%x",rd);if(strlen(rh)<2) {sprintf(rh,"0%s",rh);} sprintf(gh,"%x",gd);if(strlen(gh)<2) {sprintf(gh,"0%s",gh);} sprintf(bh,"%x",bd);if(strlen(bh)<2) {sprintf(bh,"0%s",bh);} printf("RGB(d):%d %d %d\n",rd,gd,bd); printf("RGB(h):%s %s %s\n",rh,gh,bh);
Niara
woops sorry!Originally Posted by Bubba
its win32 using visual studio 2003.
the object being to 'create a functionality that will clear the screen to an arbitrary colour'
Create a window. Make it fullscreen. Set the background color to your color of choice.
This is a very generic and unhelpful answer because it's a very generic und vague question. Post a specific question and I'm pretty sure you will get helpful answers.
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
You left out the most important part, the API. You doing it with OpenGL, DirectX, SDL, or some other library?Originally Posted by mindofpoison
The requirements for this milestone are to create functionality that:Originally Posted by Bubba
- Allows the screen to be cleared to an arbitrary colour
- Allows a pixel on the screen to be set to an arbitrary colour
- Runs at a decent frame rate
As with all milestones the code should be bug free, well commented, maintainable and contain error checking .
In order to test that the milestone requirements have been met you need to show:
- Clearing the screen to a colour
- Drawing a star filled background
using:
-win32 program
-c++ code
-visual studio 2003
-the API is HAPI
Ok now this sounds like homework.
How bout some 16-bit asm:
No that probably won't help you. But we don't help with homework.Code:... les di,0b800h mov ax,80 mob bx,25 mul ax,bc mov cx,ax xor ax,ax mov ah,color rep stosw and cx,03h rep stosb
Last edited by VirtualAce; 11-10-2005 at 02:16 PM.
If it is homework then you should have been taught how to do it. Your project is in fact quite simple. Go read an intro tutorial for DX or OpenGL.