Skip to content

Commit

Permalink
splited files with specific functions;;file managing, text editing left
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSH825 committed Sep 20, 2019
1 parent d3b5166 commit ffb4c4e
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Chamelange/cursor.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>
#include <Windows.h>

void gotoxy(int x, int y) //커서 위치 옮기기
{ //좌상단은 (0,0)이지만 (1,1)로 사용함
COORD Cur;
Cur.X = x; Cur.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Cur);
}

int now_x() //현재 x커서 위치
{ //좌상단이 (1,1)로 바뀌었을때의 정보를출력함
CONSOLE_SCREEN_BUFFER_INFO BufInfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &BufInfo);
return BufInfo.dwCursorPosition.X;
}

int now_y() // 현재 y커서 위치
{
CONSOLE_SCREEN_BUFFER_INFO BufInfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &BufInfo);
return BufInfo.dwCursorPosition.Y;
}
11 changes: 11 additions & 0 deletions Chamelange/cursor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CURSOR_H
#define CURSOR_H

#include <Windows.h>

//functions
void gotoxy(int x, int y);
int now_x();
int now_y();

#endif // !CURSOR_H
29 changes: 29 additions & 0 deletions Chamelange/interfaces.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>

int dye(int n, int f_color, int b_color, char* ch) // 이전 색 뭐였는지 유의!!
{ //n=0이면 문자, 문자열 출력 n>0이면 그만큼 반복 출력
int i = 0;
int color = f_color + b_color * 16;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
if (n > 0)
{
for (i = 0; i < n; i++)
{
printf("%c", ch);
}
return 0;
}
else if ((n == 0) && (sizeof(ch) == sizeof(char)))
{
printf("%c", ch);
return 0;
}
else if ((n == 0) && (sizeof(ch) != sizeof(char)))
{
printf("%s", ch);
return 0;
}
return 0;
}
39 changes: 39 additions & 0 deletions Chamelange/interfaces.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef INTERFACES_H
#define INTERFACES_H

#include <stdio.h>
#include <Windows.h>

#ifdef COLORS

//default colors
#define BLACK 0
#define BLUE 1
#define GREEN 2
#define CYAN 3
#define RED 4
#define MAGENTA 5
#define BROWN 6
#define LIGHTGRAY 7
#define DARKGRAY 8
#define LIGHTBLUE 9
#define LIGHTGREEN 10
#define LIGHTCYAN 11
#define LIGHTRED 12
#define LIGHTMAGENTA 13
#define YELLOW 14
#define WHITE 15

#endif // !COLORS


//functions
int dye(int n, int f_color, int b_color, char* ch);







#endif // !INTERFACES_H
Empty file added Chamelange/interrupts.c
Empty file.
9 changes: 9 additions & 0 deletions Chamelange/interrupts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef INTERRUPTS_H
#define INTERRUPTS_H

#include <Windows.h>




#endif // !INTERRUPTS_H
5 changes: 5 additions & 0 deletions Chamelange/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#include <stdio.h>
#include <stdlib.h>

#include "interfaces.h"
#include "cursor.h"
#include "interrupts.h"

int main(int argc, char* argv[])
{
Expand Down

0 comments on commit ffb4c4e

Please sign in to comment.